0 out of 464 challenges solved
Write a Python function to check whether a list of numbers contains only one distinct element or not. ```python [main.nopy] unique_element([1, 1, 1]) # Returns: True unique_element([1, 2, 1, 2]) # Returns: False unique_element([1, 2, 3, 4, 5]) # Returns: False ```
def unique_element(arr):
"""
Check if the list contains only one distinct element.
Args:
arr (list): A list of numbers.
Returns:
bool: True if the list contains only one distinct element, False otherwise.
"""
# Your code here
pass