Nov-23-2024, 01:15 PM
I just wrote this simple code to count the number of 1 in this tuple. Ironically, it returns 2 instead of 1. I have the last version of Python. Also, I checked the program with Colab, and I got the same wrong result. It is interesting that this problem occurs only for "1"!!
The result will be 2.
1 2 |
mixed_tuple = ( 1 , 3.4 , "ali" , True , [ 0 , 3 , 3 ]) print (mixed_tuple.count( 1 )) |