Skip to content
Sign upLog in
← Back to Community
How do I make it so that python will be able to tell if a number is even or odd?
Profile icon
D3LT4-M43LSTR0M

I am working on a project, and it needs to be able to discern odds from evens. I do not remember how to do that, and I would greatly appreciate it if someone could tell me how to do it.

Voters
Profile icon
D3LT4-M43LSTR0M
Comments
hotnewtop
Profile icon
ruiwenge2

heres a way you can do it:

if NUMBER % 2 == 0: # it’s even else: # it’s odd
Profile icon
CosmicBear

Write some code to see if the result of the number being divided by 2 doesn't have a decimal.