# Basic syntax:
if your_list.count(your_list[0]) == len(your_list) # or:
if len(set(your_list)) == 1
# Example usage 1:
your_list = [1,1,1,1,1,1]
if your_list.count(your_list[0]) == len(your_list):
print("All elements are identical")
else:
print("Not all elements are identical")
--> All elements are identical
# Example usage 2:
your_list = [1,1,1,2,1,1]
if len(set(your_list)) == 1:
print("All elements are identical")
else:
print("Not all elements are identical")
--> Not all elements are identical