0
Help me pls about Dictionary function
What is the result of this code? primes = {1: 2, 2: 3, 4: 7, 7:17} print(primes[primes[4]]) I already know the answer is 17 but i don't how to do could you pls explain for me thank you
7 Antworten
+ 4
Peak Kalayapichet
Dictionary uses key and values.
In primes now, key(1) has the value of 2, key(2) has the value of 3...
Now to your question:
Trying to simplify this will look like this:
primes[4] = 7
primes[7] = 17
Hope this helps 😃
+ 2
First we take the value of primes [4] that's give 7 then after again primes [7] that's give 17.
+ 1
Dictionary has key and value
a={keys: values}
If u provide a key or an index it gives output as value
+ 1
Såñtösh Màràvi no it's not primes number its about python dictionaries
+ 1
I know SAI VIDYA SAGAR RAVURI but I explain code answer of Peak Kalayapichet .
0
Okk
0
thank you ! Now i got it!