Skip to content
Home » Python Program to Print All Even Numbers in a Range

Python Program to Print All Even Numbers in a Range

Learn about Python Program to Print All Even Numbers in a Range in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Python Program to Print All Even Numbers in a Range

# Python program to print all even numbers in given range 

# give range
start, end = 1, 10

print('All even number in the range')

for num in range(start, end + 1):
    # check number is even or not
    if num % 2 == 0:
        print(num, end = " ")

Output:

All even number in the range
2 4 6 8 10

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Code : Even Number Python Program using Function