Python Fiddle Logopython-fiddle.com
AI Data Analyst Sign In
Python
capitals = {
    'canada': "Ottawa",
    'nigeria': "Abuja",
    'america': "Washington D.C",
    'united Kingdom': "London"
}

class Address:
    def __init__(self, country):
        self.country = country

    def get_capital(self):
        return capitals.get(self.country, "Capital not found")
			
address = Address('canada')
print(address.get_capital())
Click Run or press shift + ENTER to run code
Ottawa

Footer

Packages

  • Altair
  • Biopython
  • Bokeh
  • Bokeh App
  • python-docx
  • DuckDB
  • Faker
  • Folium
  • GeoPandas
  • getpass
  • igraph
  • Matplotlib
  • NetworkX
  • Numpy
  • OpenAI
  • OpenCV
  • openpyxl
  • Pandas
  • Panel App
  • Pillow
  • Pingouin
  • Plotly
  • Polars
  • python-pptx
  • ReportLab
  • Scipy
  • Seaborn
  • Scikit-Image
  • Scikit-Learn
  • SQLite3
  • Statsmodels
  • SymPy
  • Treelib
  • xlsxwriter

Use Cases

  • For Students
  • For Educators
  • For Data Scientists
  • For Developers
  • Jupyter AI Online

Company

  • Affiliate Program
  • Contact
  • Terms and Conditions
  • Privacy Policy

Online Coding Challenges

  • Newbie To Python
  • Beginner Python
  • Intermediate Python
  • Advanced Python

Tools

  • Chrome Extension
  • AI Graph Generator
  • AI Statistics Solver
  • AI Math Solver
  • Blogging With Jupyter Notebooks
  • DB Fiddle - Online SQL Playground
  • AI Python Tutor
  • Regex Playground
  • Python Visualizer
  • DuckDB Playground
  • JWT Debugger
  • Cron Job Parser
  • Markdown Editor
  • Pyp5js playground
  • URL Decoder
  • URL Encoder
  • UUID Generator
  • Base64 Image Encoder/Decoder
  • Base64 String Encoder/Decoder
  • Number Base Converter

© 2026 python-fiddle.com. All rights reserved.