A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Create a function to check EVEN or ODD in Python
Q:

Create a function to check EVEN or ODD in Python

0

Create a function to check EVEN or ODD in Python

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

In the below program – we are creating a function named "CheckEvenOdd()", it accepts a number and returns "EVEN" if the number is EVEN or returns "ODD" if the number is ODD.

# Python function to check EVEN or ODD
def CheckEvenOdd(num): 
  if (num % 2 == 0): 
    print(num," is EVEN")
  else: 
    print(num," is ODD")
  
# main code
CheckEvenOdd(11) 
CheckEvenOdd(22) 
CheckEvenOdd(33)
CheckEvenOdd(44)

Output

11  is ODD
22  is EVEN
33  is ODD
44  is EVEN

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now