You can also use a for loop on a dictionary to loop through its keys with the following:

# A simple dictionary d = {"foo" : "bar"} for key in d: print d[key] # prints "bar"

Note that dictionaries are unordered, meaning that any time you loop through a dictionary, you will go through every key, but you are not guaranteed to get them in any particular order.



Use a for loop to go through the webster dictionary and print out all of the definitions.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?