X
is a single number. Essentially I want to check in the list listaa
to know if x
is less than or equal to any element in listaa
. I have,
if x <= listaa.any():
continue
X
is a single number. Essentially I want to check in the list listaa
to know if x
is less than or equal to any element in listaa
. I have,
if x <= listaa.any():
continue
Just check if your value is less than or equal to the maximum of your list:
if x <= max(listaa):
continue
If you wish to use any
, you can use a generator expression. It's a built-in function rather than a list method.
if any(x <= i for i in listaa):
continue