Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

filter in a loop

numbers = [1, 3, 27, 10, 38]
def big(n):
    return n > 10

big_numbers = []
for num in numbers:
    if big(num):
        big_numbers.append(num)
print(big_numbers)

Output:

[27, 38]