NovFora Dev

help with python dictionaries???

Frankie Collins

Frankie Collins

2 months ago

i keep getting keyerror when trying to access my dictionary and i dont understand why because the key is literally right there in my code -- can someone please help me fix this im supposed to finish a project tonight and its not making any sense at all :(

Ethan Davis

Ethan Davis

2 months ago

okay so i have been staring at this for like forty minutes and i still dont get it... i mean i understand that you can put keys and values in them but how do you actually add something new? does python just know? or is there a function??? also what happens if i try to use the same key twice -- does it overwrite everything or crash -- this feels like homework and i didnt read the textbook

Avery Rodriguez

Avery Rodriguez

2 months ago

This has been answered literally everywhere. If you can't find .get(), collections.defaultdict for missing keys, or how to iterate with .items() in a quick search, I don't know what to tell you. The Python docs have this covered at the entry

Join the conversation to leave a reply.

Sign in to reply

Related topics