0

# why do you need to write primes â€‹â€‹2 times?

Hi, Can anyone say me why this code needs to write "(prime[prime]) And everything else? What is the result of this code? primes = {1: 2, 2: 3, 4: 7, 7:17} print(primes[primes[4]]) result 17

2 Answers

+ 4

Ok, let's begin with primes[4]
primes[4] = 7
Then we have prime[prime[4]] = prime[7]
Then we have prime[7] = 17

+ 1

It's not about need.. Its to understand the logic, how it is extracting the result 17 in a different in direct one way.....
Inner result for primes[4] is 7 and then,
primes[7] = 17 is the output...