I'm writing a small function to check if all elements in a list are less than or equal to a limit. This is just for practice, and should be done without using any loops.
def small_enough(a, limit):
return all(x <= limit for x in a)
small_enough([66, 101], 200)
Been on this for a while but I can not find any substituting code to replace the for
loop.This code works perfectly fine as it is - however, I am trying to get the results without using loops. Trying to write something a bit more 'pythonic'.