

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Check if a Number is Odd or Even using Python?
Python's modulo (%) operator (also called remainder operator) is useful to determine if a number is odd or even. We obtain remainder of division of a number by 2. If it is 0 , it is even otherwise it is odd
no=int(input('enter number')) if no%2==0: print ('{} is even'.format(no)) else: print ('{} is odd'.format(no))
The output
enter number25 25 is odd enter number40 40 is even
- Related Questions & Answers
- Check if count of divisors is even or odd in Python
- How to determine if a number is odd or even in JavaScript?
- Java Program to Check Whether a Number is Even or Odd
- C++ Program to Check Whether Number is Even or Odd
- PHP program to check if the total number of divisors of a number is even or odd
- Program to check if a number is Positive, Negative, Odd, Even, Zero?
- Check whether given floating point number is even or odd in Python
- Python Program for Check if the count of divisors is even or odd
- Java Program to check if count of divisors is even or odd
- C Program to Check if count of divisors is even or odd?
- C# Program to check if a number is Positive, Negative, Odd, Even, Zero
- 8085 program to check whether the given number is even or odd
- Python Program to Determine Whether a Given Number is Even or Odd Recursively
- How to check if a number is positive, negative or zero using Python?
- Splitting number to contain continuous odd or even number using JavaScript
Advertisements