Solution
Full Code
even_numbers = []
for i in range(1, 21):
if i % 2 == 0:
even_numbers.append(i)
print(even_numbers)
Quick Explanation
This loop goes from 1 to 20 and adds every even number to the list using the % 2 == 0
condition. Note that we use 21 as the upper bound of the range.
Finally, after exiting the look, we print out the result.