premaseem.wordpress.com
Python: Check if all elements in a list are equal
# Pythonic ways of checking if all # items in a list are equal: >>> lst = [‘a’, ‘a’, ‘a’] >>> len(set(lst)) == 1 True >>> all(x == lst…