Write a python function to check whether all elements are equal to each other


Topic: Write a python function to check whether all elements are equal to each other

Solution

def all_equal(iterable):
    from itertools import groupby
    g = groupby(iterable)
    return next(g, True) and not next(g, False)



List all Python Programs