Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
itertools recipe from python docs solution in Speedy category for All the Same by Phil15
# https://docs.python.org/3/library/itertools.html#itertools-recipes
from itertools import groupby
def all_the_same(iterable):
"Returns True if all the elements are equal to each other"
g = groupby(iterable)
return next(g, True) and not next(g, False)
March 6, 2020