Unit 3 Task 12: Capital city lookup

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Unit 3 Task 12 - Capital city lookup

← Unit 3 tasks - Solution


Store at least four country names (keys) and their capitals (values) in a dictionary.

Loop: ask for a country. If the user types quit, exit. Otherwise print the capital, or Unknown country if the key is missing (use in or .get()).

Skills: dict, input, while loop.