Write a Python program to print only even numbers using function

In this source code example, we will write a python program to print only even numbers using a function.

Write a Python program to print only even numbers using a function

for number in range(1, 50):
    if number % 2 != 0:
        continue
    print(number)

Output:

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48


Comments