Fabulous Feb Offer: Flat 70% Off + 20-days Extra Lab + 10% Addl. Off on All Courses | Use Coupon Code FAFB | Expires in

  Enroll Now

Python - Videos and Questions

47 / 78

Print Even Numbers up to n

Write a function with the name print_even which takes one argument n. This function should print all even numbers starting from 0 up to but not including n.

This is how the definition is supposed to look:

def print_even(n):
    # This is where your code should print

Example Test Cases:

if n is 4, calling print_even(4) should print:
0
2


if n is 5, calling print_even(5) should print:
0
2
4

if n is 0, calling print_even(0) should not print anything.