Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in Example 2 of Day 13 #553

Open
jasperhabicht opened this issue Jul 11, 2024 · 0 comments
Open

Issue in Example 2 of Day 13 #553

jasperhabicht opened this issue Jul 11, 2024 · 0 comments

Comments

@jasperhabicht
Copy link

jasperhabicht commented Jul 11, 2024

In Example 2 of Day 13, it says:

# 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant