here's my code:
fList = {7:7, 9:9}
def checkList():
if not None in fList:
print(fList)
fL = random.choice(fList)
ttt[fL] = computerLetter
del fList[fL]
print(fL)
print(ttt)
print(fList)
Python throws me this error:
{9: 9, 7: 7}
Traceback (most recent call last):
File "/home/jason/Desktop/Programming/Python3_5/TestCode.py", line 35, in <module>
checkList()
File "/home/jason/Desktop/Programming/Python3_5/TestCode.py", line 22, in checkList
fL = random.choice(fList)
File "/usr/lib/python3.5/random.py", line 265, in choice
return seq[i]
KeyError: 0
This was working fine when there were move key:value pairs in the dictionary. I'm having trouble understanding whats wrong. Thank you in advance for your time and attention.