Answers for "python how to check if all elements in list are the same"

2

python how to check if all elements in list are the same

List = ['Mon','Mon','Mon','Mon']
// Result from count matches with result from len()
result = List.count(List[0]) == len(List)
if (result):
   print("All the elements are Equal")
else:
   print("Elements are not equal")
Posted by: Guest on August-05-2020
2

how to check if the to list are the same in python

>>> [0,1,2] == [0,1,2]
True
>>> [0,1,2] == [0,2,1]
False
>>> [0,1] == [0,1,2]
False
Posted by: Guest on December-06-2020

Code answers related to "python how to check if all elements in list are the same"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language