+ 10

How the answer is 2? I want Explaination.

Here is the SS. I want to know how the answer is 2 and how count woks for array? https://www.sololearn.com/post/487122/?ref=app

7th Aug 2020, 5:11 PM
A͢J
A͢J - avatar
6 Antworten
+ 10
Yes, very sure, Namit Jain . AJ #L1G3 , this is because true == 1, false == 0, therefore the last two assignments override the previous two..., finally the array contains only two elements
7th Aug 2020, 5:19 PM
ProfOduola🙏🇳🇬
ProfOduola🙏🇳🇬 - avatar
+ 8
MiKoLa🔥3L17.4L16.2.5k=>L18 Ok got it. Here array contains objects so false will replaced by 0 and true will replaced by 1.
7th Aug 2020, 5:26 PM
A͢J
A͢J - avatar
+ 7
true == 1 false == 0 So, We have only 2 terms🤔 Not sure👦
7th Aug 2020, 5:13 PM
Namit Jain
Namit Jain - avatar
+ 5
AJ #L1G3 yes👦
7th Aug 2020, 5:27 PM
Namit Jain
Namit Jain - avatar
+ 3
Dictionaries should have unique keys. Here true and 1 are the same so only one key is initialized. Same goes to false and 0. Thus it results in an array of length 2. Happy coding!
9th Aug 2020, 2:53 AM
MSN
MSN - avatar