0
More Types Dictionary Functions section, quiz one three
Why I get this error whenever I change the value of primes[4] to a number such as 3 or 2. It works with numbers 1 and 4 though. I don't know why? Just confused. primes = {1: 2, 2: 3, 4: 7, 7:17} print(primes[primes[3]]) I get this error: "Traceback (most recent call last): File "C:/Users/Python/SoloLearn/sololearn3.py", line 2, in <module> print(primes[primes[3]]) KeyError: 3" Thanks
2 Answers
+ 7
You only have the following keys in your dictionary: 1, 2, 4 and 7. As you can see đ Key 3 is non existent.
+ 1
could it be that there is no key for the number 3?