Fix Python – Check if all values in list are greater than a certain number
my_list1 = [30,34,56]
my_list2 = [29,500,43]
How to I check if all values in list are >= 30? my_list1 should work and my_list2 should not.
The only thing I could think of doing was:
boolean = 0
def func(ls):
for k in ls:
if k >= 30:
boolean = boolean + 1
else:
boolean = 0
if boolean > 0:
pri….