python check if lists are equal code example
Example 1: how to check if all values in list are equal python
res = all(ele == lst[0] for ele in lst)
if(res):
print("Equal")
Example 2: how to check if all values in list are equal python
if len(lst) < 0 :
res = True
res = lst.count(lst[0]) == len(lst)
if(res):
print("Equal")
Example 3: 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