Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to use if else to prove a variable even or odd in python

#To check if the given number is even or odd
num = int(input("Enter a number: "))
if (num % 2) == 0:
   print("{0} is Even".format(num))
else:
   print("{0} is Odd".format(num))
Comment

PREVIOUS NEXT
Code Example
Python :: coco.py 
Python :: if you assign the result a void function to a variable in python, you get: 
Python :: python exceute 60 records per minute counter 
Python :: How to Copy a File in Python? 
Python :: How can I get terminal output in python 
Python :: scanning 2d array in python 
Python :: cvtcoloer opencv 
Python :: bs4 table examples python 
Python :: how to use enumerate instead of range and len 
Python :: python truncate to integer 
Python :: windows alert python 
Python :: download a file from kaggle notebook 
Python :: python writing to csv file 
Python :: get n random numbers from x to y python 
Python :: python current utc offset 
Python :: pandas correlation 
Python :: openpyxl change sheet name 
Python :: sorting pandas dataframe like excel 
Python :: perfect number program in python 
Python :: pandas object to float 
Python :: PIL Make Circle 
Python :: find duplicate in dataset python 
Python :: delete a row in pandas dataframe 
Python :: python socket recv timeout 
Python :: converting datetime object format to datetime format python 
Python :: my pygame window wont stay open 
Python :: python shuffle list with seed 
Python :: printing with format float to 2 decimal places python 
Python :: sample datafra,e PYTHON 
Python :: python datetime without seconds 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =