I have to find all list elements are equal.
I have used below code:
all(x == list[0] for x in list)
Now I have to find all list values are different. Please help me how to achieve this.
List = ['a', 'b', 'x', 'y']
Expected Output: True
List = ['a', 'a', 'x', 'y']
Expected Output: False
List = ['a', 'a', 'a', 'a']
Expected Output: False
Tried below code:
list = ["aa", "bb", "bb"]
len(set(list)) != 1
output:
will result True.
I am expecting False, reason bb is same elements repeated