Hello reader, here is a Python programme to find an entered number is odd or even. This programme could be useful for cracking interviews or could be useful for school / college students who wish to learn the basic of Python programming.
This programme basically gets the input number from the user and prints the output whether the number is Odd Number or Even Number.
Here is the Python 3 script:
1 2 3 4 5 6 7 8 9 10 11 12 |
print ("Find Odd or Even number") # get the input number from user using input() print ("Enter a number") num = int(input()) # use % modulus to figure out whether the # entered number is odd or even. if num % 2 == 0: print (num,"is an Even number!") else: print (num,"is an Odd number!") |
Read the comments in the above program to understand the logic, it’s a very simple program.