Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check if all elements in list are equal

# check if all elements in list are equal
my_list = [1, 1, 1, 1, ]
def check_if_equal(list):
    if len(set(list)) == 1:
        print('True')  				# output True
    else:
        print('False')

check_if_equal(my_list)
 
PREVIOUS NEXT
Tagged: #check #elements #list #equal
ADD COMMENT
Topic
Name
9+4 =