0
Dictionary access
Can someone explain why this is working primes = {1:2,2:3,4:7,7:17} print(primes[primes[4]]) And outputing 17? The value of 4 in the dict is 7, and why is this nested access , how does that work primes[primes]? I dont get it, i thought you would do primes[7] to get the value 17?
1 Answer
+ 1
primes[ primes[4] ]
inner instruction result primes[4] =>7
Now instruction is primes[7] which result 17
so
primes[ primes[4] ] =>primes[ 7 ] => 17