Computer Science, asked by shrishti1708, 2 months ago

3. Write a Python function, odd, that takes in one number and returns True when the number is
odd and False otherwise. You should use the % (mod) operator, not if.​

Answers

Answered by allysia
70

Language:

Python

Program:

def odd(n):

   return n%2!=0

Output:

consider the attachment.

Explanation:

  • def : defines a function.
  • a%b : modulus operator returns the remainders when a is divided by b.
  • a!=b : returns True if a is not equal to b else False.
  • returns : gives output of the statement written after it.

Attachment:

Attachments:
Similar questions