- 1
Dictionary Functions: Keys
Concerning the following code: What is the result of this code? primes = {1: 2, 2: 3, 4: 7, 7:17} print(primes[primes[4]]) I got the right answer, but I don't understand why. Without giving it away (or attempting not to), wouldn't the first "primes" be multiplied by the second "primes"? So, if it read "print(primes[primes[3]])" instead, wouldn't it be 7 * 7, or 49 for the final output? Thanks in advance! ~M
1 Answer
+ 3
primes[4] return the value 7. Now, primes [7] return the value 17.