0
How this function works?
x.count(x[0]) == len(x) It's used to check if the item in the list are identical.. But i can't figure out how it's actually working..
5 odpowiedzi
+ 2
Depends what you meant with "identical", here is an example, where items have the same value, but different datatype.
[0, False, 0.0, 0j].count(0)
And it would return 4.
+ 1
x.count([1, 1, 1])
+ 1
Thank you!
0
x = [[1, 1, 1],
[0,2, 0],
[1, 2, 0]]
How about this example..can you tell me how it will or work on this
0
I got it..