You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Filter numbers: let's filter out positive even numbers from the list below
numbers = [-8, -7, -3, -1, 0, 1, 3, 4, 5, 7, 6, 8, 10]
positive_even_numbers = [i for i in range(21) if i % 2 == 0 and i > 0]
print(positive_even_numbers) # [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
But this does not filter the list defined in numbers. It should probably rather be as follows:
# Filter numbers: let's filter out positive even numbers from the list below
numbers = [-8, -7, -3, -1, 0, 1, 3, 4, 5, 7, 6, 8, 10]
positive_even_numbers = [i for i in numbers if i % 2 == 0 and i > 0]
print(positive_even_numbers) # [4, 6, 8, 10]
Also, a blank line should be added before this example to separate it from the one above.
The text was updated successfully, but these errors were encountered:
In Example 2 of Day 13, it says:
But this does not filter the list defined in
numbers
. It should probably rather be as follows:Also, a blank line should be added before this example to separate it from the one above.
The text was updated successfully, but these errors were encountered: