all_equal

iteration_utilities.all_equal(iterable, /)

Checks if all the elements are equal to each other.

Parameters:
iterableiterable

Any iterable to test.

Returns:
all_equalbool

True if all elements in iterable are equal or False if not.

Notes

If the input is empty the function returns True.

Examples

>>> from iteration_utilities import all_equal
>>> all_equal([1,1,1,1,1,1,1,1,1])
True
>>> all_equal([1,1,1,1,1,1,1,2,1])
False