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())
Ottawa