Write a Python Program to Check Whether an Entered Number is Odd or Even Tutorial For Beginners
1K views
Jun 1, 2025
Get the full source code of application here:
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I'll show you a very
0:04
common program inside Python how to
0:08
check whether an entered number is even
0:10
or odd uh it's a very simple program
0:12
guys
0:14
uh whether a number is even it must be
0:17
divisible by
0:19
two or any even number for this we'll
0:23
put a condition right here if it's a
0:25
even number then it should be divisible
0:26
by two and here as you can see we're
0:28
asking the user by the input function
0:31
enter a number the user will write a
0:34
number right here let's suppose they
0:35
write
0:38
six so they write six so so six number
0:43
must be divisible by two so here we put
0:45
this if condition right here if the
0:47
number should be divisible by two and we
0:50
use this percentage sign here percentage
0:53
means that the remainder should be zero
0:55
so if the remainder is zero when divi
0:58
divided by two then it's a even
1:02
number if we are getting a remainder
1:05
then in that case it it's not divisible
1:08
entirely so it's a odd number so very
1:11
simple condition and if I run this
1:14
program here you will actually see how
1:16
simple it is so we as soon as we write
1:19
uh execute this program it will ask you
1:22
to enter a number we basically write a
1:24
number right here let's suppose six so
1:28
now the six is a even number because
1:31
this condition evaluates to true because
1:34
if you just manually divide 6 by
1:38
2 so 2 3
1:41
are six and we get zero
1:46
remainder but now in this case if I say
1:50
number seven so 7 is not entirely
1:53
divisible by two we get a remainder of 1
1:58
that's why it's a odd
2:01
number so let me show
2:03
you so if you divide 7 by 2 so 2 3's are
2:09
6 and we still get a remainder of one so
2:13
that's why remainder is not
2:16
zero so that's why it is a odd number so
2:20
this is a definition of a even number
2:23
even numbers are those numbers which are
2:24
divisible by two so seven is not
2:28
divisible by two so that's why it's a
2:32
odd number so if I take let's suppose
2:35
9 just pause the video and just answer
2:39
what will be the
2:41
output so 9 is again a odd number
2:44
because it's not divisible by two
2:48
so in this easy way guys you can put
2:50
this condition and check whether entered
2:52
number is odd or even so thank you very
2:55
much for watching this video and also
2:57
check out my website freemediatools.com
3:00
uh which contains thousands of tools