Filter
Exclude
Time range
-
Near
Replying to @clcoding
In the list k = [2,1,0,3,0,2,1], k.index(0) finds the first zero's index, which is 2. Now, guess how many times '2' appears in the list? Bingo! Twice. That's why k.count(k.index(0)) prints 2! 🎯💡 #PythonPuzzles #CodeBreakdown #PythonGiants
2
469
Replying to @RealBenjizo
In Python, 2 and 2.0 are seen as identical keys in a dictionary. So when you have {2.0: "love", 2: "Python"}, the latter overwrites the former. Result? Calling d[2.0] fetches "Python"! 🐍 #PythonFacts #PythonGiants
2
1,199
Replying to @PythonGiants
Well explained.
1
13