I get the code given down below on sololearn challenge, can somebody tell me why here the dictionary length is coming out 4? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

I get the code given down below on sololearn challenge, can somebody tell me why here the dictionary length is coming out 4?

d = {'s':'o', 'l':'o', 'l':'e', 'a':'r', 'n':'!'} print(len(d)) I also tried it with some other examples but only in this its happening, in others the length is coming 5, and here also it should be 5 then what's the problem...

7th Apr 2020, 7:18 AM
Sp Maurya
Sp Maurya - avatar
2 Respostas
+ 3
If key is already exist in dictionary, then the value is just replaces old value. Not allows dublicate key in dictionary... So only 4 keys with 4 values...
7th Apr 2020, 7:27 AM
Jayakrishna šŸ‡®šŸ‡³
0
JayakrishnašŸ‡®šŸ‡³ got it... I didn't noticed that earlier... šŸ˜…
7th Apr 2020, 7:33 AM
Sp Maurya
Sp Maurya - avatar