How to Check Positive, Negative or Zero Number in Python – GATE, Interview & Placement Practice
3K 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 will show you a Python
0:05
program which is commonly asked inside
0:07
Python interviews for placements and
0:09
competitive exams such as GATE so
0:12
whether to detect a number is positive
0:14
negative or zero and for this we have
0:18
this program right here and if you just
0:20
run this program and it will ask you to
0:22
provide a
0:23
number let's suppose I say four as you
0:27
can see it's a positive number so it
0:29
will detect so you will see the number
0:31
is positive again if I run if I say
0:35
-7 so it will say the number is negative
0:38
once again if I run this and if I say
0:41
zero you will see the number is
0:44
zero and it's a very easy program
0:49
so here if you see we have a series of
0:53
conditions that we put if conditions if
0:57
you know if if block in programming if
1:01
basically act as you can have multiple
1:03
conditions in your program so if I say
1:05
four so we have put this numerous
1:09
conditions here if the number is greater
1:12
than zero then it's obviously a positive
1:15
number if it's smaller than zero
1:18
then obviously it's a negative number or
1:20
if it is equal to zero then the number
1:22
is zero so we have these three if
1:25
conditions if this is else if and
1:29
else so using this if I put four right
1:32
here you will see now it will come to
1:36
this condition this condition will
1:37
evaluates to true and then this
1:41
statement will be printed out the number
1:42
is positive the program will end
1:48
so if
1:50
I provide negative this condition will
1:53
avulate to true the number is negative
1:55
so in this way you can detect whether
1:56
the number is positive negative or zero