‘values’ method is used to loop through all the values in a dictionary.
>>> country_capitals = {"India" : "New Delhi", "Bangladesh" : "Dhaka", "France" : "Paris"}
>>>
>>> for capital in country_capitals.values():
... print(f"{capital}")
...
New Delhi
Dhaka
Paris
No comments:
Post a Comment