in Python by
Q:
Write a function, which will take in a value and print out if it is even or odd.

▼ Show 1 Answer

0 votes
by

The below code will do the job:

Here, we start off by creating a method, with the name ‘even_odd()’. This function takes a single parameter and prints out if the number taken is even or odd.

Now, let’s invoke the function:

We see that, when 5 is passed as a parameter into the function, we get the output -> ‘5 is odd’.

Python
Learn More with Madanswer

Related questions

0 votes
asked Dec 14, 2019 in Python by sheetalkhandelwal
...