I'm using Python and I'm trying to figure out how to ascertain whether all numbers in a list are the same or different (even with just one integer being different) if beforehand I don't know the total number of elements in the list. Initially I wrote something like:
def equalOrNot(lst):
if sum(lst)%len(lst)==0:
return False
else:
return True
But it's not working in all cases. Any suggestions? Thanks