Someone pls tell me wtf to do for iterating over a dictionary wtf


#1



Oops, try again. It looks like you didn't print out all the keys and values in movies. You should have printed something like this: [("Monty Python's Life of Brian", 'Good'), ("Monty Python's Meaning of Life", 'Okay'), ('Monty Python and the Holy Grail', 'Great')].


Replace this line with your code. 
movies = {
	"Monty Python and the Holy Grail": "Great",
	"Monty Python's Life of Brian": "Good",
	"Monty Python's Meaning of Life": "Okay"
}

print filter(lambda x: movies.items() and movies.value(),movies)
print movies.items()


#2

Change your code-line

to
#print filter(lambda x: movies.items() and movies.value(),movies)

The docs
https://docs.python.org/3/tutorial/datastructures.html#dictionaries

discussions/opinions
https://stackoverflow.com/questions/26660654/how-do-i-print-the-key-value-pairs-of-a-dictionary-in-python


#3

I don't know if you are trying the hard way on purpose or not but the easiest way to do this(as it says on hint):
if you want to print keys: movies.keys()
if you want to print values: movies.values()
if you want to print both of them: movies.item()

dont forget to put print before them.


#4

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