Dict print out

https://www.codecademy.com/courses/learn-python/lessons/advanced-topics-in-python/exercises/iterating-over-dictionaries?action=resume_content_item

I noticed that the print out in the rightmost is:
[(“Monty Python’s Life of Brian”, ‘Good’), (“Monty Python’s Meaning of Life”, ‘Okay’), (‘Monty Python and the Holy Grail’, ‘Great’)]

why the values are all with single quotation marks instead of double quotation marks? why is the last key is also with single quotation marks?

The double quotes would indicate there is an apostrophe in the key or value. print is being coerced to use them. For all other cases, print is coerced to use single quotes.

It may well be dict.items() in which the coercion occurs, which would make more sense, now that one thinks about it.

Thanks! Great help!

1 Like