Condition statement without loops
If using numpy
is ok, you can do
import numpy as np
x = np.asarray([66,101])
print(all(x <= 200))
In general,
f(x) for x in xs == map(f, xs)
so
def small_enough(a, limit):
return all(map(lambda x: x <= limit, a))