Skip to content

Latest commit

 

History

History
11 lines (9 loc) · 262 Bytes

How_to_find_if_the_number_is_odd_or_even_in_python.md

File metadata and controls

11 lines (9 loc) · 262 Bytes

How to find if the number is odd or even in python

The % (mod) get the rest of division between two numbers, so if the x is even, the rest of x with 2 is 0.

number = 2

if number%2 == 0:
    print(number,"is even")
else:
    print(number, "id odd")