I'm trying to use a for loop to print out each person and their responses but keep getting the error "too many values to unpack" and I'm not sure why. I'm trying to finish exercises in a Python tutorial. This is my code:
question = {'Kim':'Yes',
'Sarah':'No',
'Jake':'Maybe'}
for friends, answer in question:
print("\nFriend:%s" % friends)
print("Answer:%s" % answer)
And this is the error I'm receiving:
ValueError Traceback (most recent call last)
<ipython-input-15-38fd8bb38999> in <module>
8 'Sarah':'No',
9 'Jake':'Maybe'}
---> 10 for friends, answer in question:
11 print("\nFriend:%s" % friends)
12 print("Answer:%s" % answer)
ValueError: too many values to unpack (expected 2)
Could someone please explain to me how to accurately retrieve the responses in the list while using a for loop.