Syntax with a condition

Report a typo

Match a list comprehension expression with the value of new_list where the old_list is:

old_list = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
Match the items from left and right columns
new_list = [x for x in old_list if x % 2 == 0]
new_list = [x for x in old_list if x >= 8]
new_list = [x*2 for x in old_list if x < 13]
new_list = [x*2 for x in old_list if x % 2 == 1]
new_list = [x*2 for x in old_list]
[2, 2, 6, 10, 26, 42, 110]
[8, 13, 21, 34, 55]
[2, 2, 4, 6, 10, 16, 26, 42, 68, 110]
[2, 2, 4, 6, 10, 16]
[2, 8, 34]
___

Create a free account to access the full topic