Write a program to accept name of 10 countries and their capital.Input name of countries and find whether it exist in the list if
yes then display name of country and its capital?
Answers
Answered by
0
def find_capital(country):
countries = {
"Austria": "Vienna",
"Bulgaria": "Sofia",
"Canada": "Ottawa",
"Denmark": "Copenhagen",
"Egypt": "Cairo",
"France": "Paris",
"Germany": "Berlin",
"Hungary": "Budapest",
"India": "Delhi",
"Japan": "Tokyo"
}
if country not in countries:
return "Country not found!"
return f"Country: {country}\nCapital: {countries[country]}"
country = input("Enter country: ")
print(find_capital(country))
Similar questions
Math,
3 months ago
India Languages,
3 months ago
English,
6 months ago
Biology,
6 months ago
English,
1 year ago