Skip to content

Tag: key

How to add multiple values per key in python dictionary

My program needs to output a list of names with three numbers corresponding to each name however I don’t know how to code this is there a way I could do it as a dictionary such as cat1 = {“james”:6, “bob”:3} but with three values for each key? Answer The value for each key can ei…

Is it reasonable to use None as a dictionary key in Python?

None seems to work as a dictionary key, but I am wondering if that will just lead to trouble later. For example, this works: The actual data I am working with is educational standards. Every standard is associated with a content area. Some standards are also associated with content subareas. I would like to m…