Simple using the range() function you can Write a program to display even numbers between 10 and 20 in Python. You need to define start, stop and step parameters.
range(start, stop, step)
Example display even numbers between 10 and 20 in Python
Simple example code using step set to 2 because the start value is even number.
for i in range(10, 20, 2): print(i)
Iterate from start till the range in the list using for loop and check if num % 2 == 0. If the condition satisfies, then only print the number.
start, end = 10, 20 for num in range(start, end + 1): # checking condition if num % 2 == 0: print(num, end=" ")
Output: 10 12 14 16 18 20
Do comment if you have any doubts or suggestions on this Python number topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.