# Program to print the even numbers in the given range using Python

## Introduction

In the last section we have understood to find the even numbers in the given list. Now we will find the even numbers in the range (includes the lower and upper bound)  given by user. The expression used to find the even is the same as what we have used earlier.

Expression: num % 2 == 0

## Program

```n = int(input("Enter the strat of range: "))
m = int(input("Enter the end of range: "))
# Using for oop
new_list = []
for i in range(n, m+1):
if i % 2 == 0:
new_list.append(i)
print("Even numbers in the range {0} to {1} is {2}".format(n,m, new_list))```

## Explanation

In the above python code, we have used for loop and traverse it between the range given by the user. For each value in the range the even condition is checked, and if the condition is true the value is appended into the list. When all the values are traversed the even numbers appended in the list are printed on the screen

This site uses Akismet to reduce spam. Learn how your comment data is processed.