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_equal
bool
True
if all elements in iterable are equal orFalse
if not.
- all_equal
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