Jun-17-2017, 10:51 PM
How do I get multiple keys in a dictionary to point to one item?
I keep getting key errors when I call more than one key.
I want two dics where all the keys in one point to item '1' and all the keys in the other point to item '2'.
I will then convert items '1' and '2' to ints so I can sum them and use the sum as a boolean check(3 = True).
I keep getting key errors when I call more than one key.
I want two dics where all the keys in one point to item '1' and all the keys in the other point to item '2'.
I will then convert items '1' and '2' to ints so I can sum them and use the sum as a boolean check(3 = True).
names = {'Taft':'1', 'Wilson':'1', 'Cleveland':'1'} print names['Taft', 'Wilson']
Error:Traceback (most recent call last):
File "nav.py", line 3, in <module>
print names['Taft', 'Wilson']
KeyError: ('Taft', 'Wilson')