All the Same

All the Same

We have prepared a set of Editor's Choice Solutions. You will see them first after you solve the mission. In order to see all other solutions you should change the filter.

In this mission you should check if all elements in the given sequence are equal.

example

Input: List.

Output: Logic value (bool).

Examples:

assert all_the_same([1, 1, 1]) == True
assert all_the_same([1, 2, 1]) == False
assert all_the_same([1, "a", 1]) == False
assert all_the_same([1, 1, 1, 2]) == False

The idea for this mission was found on Python Tricks series by Dan Bader

Precondition: all elements of the input list are hashable

40