Skip to content

What do you think is the answer? #375

Closed Answered by muslumhanozturk
batuhangithub asked this question in Q&A
Discussion options

You must be logged in to vote

Original list

lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Create an empty list to store even numbers

even_numbers = []

Iterate through the list and add even numbers to the new list

for num in lst:
if num % 2 == 0:
even_numbers.append(num)

New list containing even numbers

print(even_numbers)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by batuhangithub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants