In python, you can use a simple list comprehension to solve this problem.
print([x for x in range(51) if x % 2 == 0])
This code prints all the even numbers from 0 to 50 including 0 and 50.
6.3m questions
8.3m answers