MeshWorld India LogoMeshWorld.
PythonProgram1 min read

Identify whether the number is Even or Odd in Python

(Updated: Jun 22, 2026)
Listen to ArticleAI Speech
~1 min read narration
100%
Identify whether the number is Even or Odd in Python

If any number is exactly divisible by 2 then it’s an even number else it’s an odd number.

In this tutorial we’ll see how to check whether the provided number is even or odd number using Modulo(%).

Flowchart

Flowchart for odd even Flowchart for odd even

Note

  • The remainder calculated with %(Modulo) on dividing by 2, will always be 0 for all even numbers.
  • Whereas the remainder on dividing by 2, will always be 1 for all odd numbers.

Code

a = int(input('Enter number: '))
rem = a % 2

print('A:', a)
print('Remainder:', rem)

if rem == 0
    print(a, 'is an even number')
else:
    print(a, 'is an odd number')

'''
    Remainder after dividing by 2
    12 % 2 -> 0
    13 % 2 -> 1
    14 % 2 -> 0
    15 % 2 -> 1
    16 % 2 -> 0
    17 % 2 -> 1
    18 % 2 -> 0
    19 % 2 -> 1
    20 % 2 -> 0
    21 % 2 -> 1
    22 % 2 -> 0
'''

Output

Enter number: 58147
A: 58147
Remainder: 1
58147 is an odd number

Happy 😄 coding

Reader Quality Feedback

Did this technical guide help solve your problem?

Suggest Errata ($0)
Vishnu
Primary Author

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Explore Author Archive
Compute Fuel & Open Testbed
100% Independent & Verified

Fuel High-Density, Zero-Fluff Engineering Deep-Dives

Every guide on MeshWorld is validated on physical Linux nodes and reproducible testbeds. If this article saved you hours of debugging or unblocked production, consider funding our next cluster run.

Weekly Dispatch

Join MeshWorld Dispatch

Get practical tutorials, system blueprints, and curated AI engineering notes straight to your inbox. No fluff, zero spam.

Zero spam. 1-click unsubscribe anytime.Prefer RSS?
Curated Continuations

Up Next in This Domain.

Browse Full Archive