The 'in' operator


#1



Exercise 3 - The 'in' operator


I Think this code should work as it displays all the keys in my_dict however the error message says 'Oops, try again. It looks like you did not print out every key in my_dict.'


Please can someone explain what I'm doing wrong.

Thanks in advance

my_dict = {
    "animals": "zebra",
    "zoo": 3,
    "active": "true",
}
for key in my_dict:
    print key, my_dict[key],


#2

What happens when you remove the last comma?


#3

oh right, thank you. sometimes you just need someone to take another look at spot things out.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.