from typing import List, Any
def allthesame(elements: List[Any]) -> bool:
if len(elements) == elements.count(elements[0]) or len(elements) < 1:
return True
else:
return False
Example:
True
===
IndexError: list index out of range, allthesame, 7
Fail: allthesame([])
Created at: 2019/12/18 03:25; Updated at: 2019/12/18 04:44
The question is resolved.