Python Introducing Dictionaries Iterating and Packing with Dictionaries Recap of Iterating and Packing with Dictionaries

Nicholas Dallas
Nicholas Dallas
2,691 Points

Recap of iterating and packing with dictionaries 2 & 3

I tried both methods that they went over in the video.

I tried

.items() .**kwargs()

I don't see the kwargs working there but I tried it anyway. I may have missed another technic in the video that I'm just not understanding.

Thank you in advance.

1 Answer

Pratham Mishra
Pratham Mishra
13,154 Points

You are not supposed to put the parenthesis with **kwarags

Pratham Mishra
Pratham Mishra
13,154 Points

I am assuming that's the problem, I cannot figure out the exact problem as you've not attached ur code. It'll be great if you do so.

Nicholas Dallas
Nicholas Dallas
2,691 Points

student = {'name': 'Craig', 'major': 'Computer Science', 'credits': 36}

for key, val in student.item(): print(key) print(value)

Nicholas Dallas
Nicholas Dallas
2,691 Points

Complete the code so it will iterate over only the keys in the student dictionary.

student = {'name': 'Craig', 'major': 'Computer Science', 'credits': 36}

for key in student.items(): print(key)

Nicholas Dallas
Nicholas Dallas
2,691 Points

it was For key in student.keys()

I ended up figuring it out

Thank you, Nicholas