Capital city
Sign in to test your solution.
# Capital city program
# -------------------------
# Subprograms
# -------------------------
def check_answer(country, city):
if country == "England" and city == "London":
return True
if country == "France" and city == "Paris":
return True
else:
return False
def capital_cities():
correct = False
while not correct:
city = input("What is the capital city of England? : ")
correct = check_answer("England", city)
correct = False
while not correct:
city = input("What is the capital city of France? : ")
correct = check_answer("France", city)
# -------------------------
# Main program
# -------------------------
capital_cities()
print("The quiz is complete.")
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.
Python sandbox
This window allows you to run Python code without installing a thing. The code you write here is not automatically submitted to Dodona.