Answers for "can python recognize odd and even numbers"

4

how to find if a value is even or odd in python

num = int(input("Enter a Number:"))
if num % 2 == 0:
  print(num , "is even")
else:
  print(num , "is odd")
Posted by: Guest on June-06-2021
1

fastest way to check odd or even in python

>>> def isodd(num):
        return num & 1 and True or False

>>> isodd(10)
False
>>> isodd(9)
True
Posted by: Guest on September-14-2020

Code answers related to "can python recognize odd and even numbers"

Python Answers by Framework

Browse Popular Code Answers by Language