Please answer this question. I am not able to get the answer


#1

Please explain functions too. Thanks

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.

#2

Hi,
May I know what logic you have written for this question?
and what error you are getting ?
Kindly share the screenshots.
I will be happy to help.

All the best!


#3

Sir, I cannot answer this particular question may I have an answer?


#4

Hi,
Sorry, we don’t share answers. Kindly look at the hints or try to check the comments below the question to get the idea.
If you have written the program share here, I will try to help you.

All the best


#5

Alright. Thanks.

Can you explain functions in python