diff --git a/Chapter_06/6-05_rivers.py b/Chapter_06/6-05_rivers.py new file mode 100644 index 0000000..d59d672 --- /dev/null +++ b/Chapter_06/6-05_rivers.py @@ -0,0 +1,26 @@ +# Exercise 6-5 Rivers +# Learning Objective: Use a loop on a dictionary using: +# A.) Both Kay and Value +# B.) Just Keys +# C.) Just Values + +rivers = {'nile': 'egypt', 'mississippi': 'united states', 'volga': 'russia',} + +# A. Both Key and Value: +for river, country in rivers.items(): + print(f"\nThe {river.title()} runs through {country.title()}.") + +print("\n-----------------------------------") +#B. Just Key: + +for river in rivers.keys(): + print(f"\nWe have the {river.title()} river in this dictionary.") + +print("\n-----------------------------------") + +#C. Just Values: + +for country in rivers.values(): + print(f"\nWe have the country {country.title()}, in this dictionary.") + +print("\n-----------------------------------")