Introduction
In this post, you will learn how to check a number is positive, negative or zero in python and below is the video format of the post, check it out.
Video
Check a number is positive, negative or zero in python source code
Before we get into the subject you need to know about ????????
Source code: if,else,elif
Here firstly, I have entered the variable num and asked the user to input the value and the data type is float and then I added an if statement that if num is greater than zero then it is positive.
Then I added the elif statement and said elif less than zero and the print as negative and then finally the else statement is zero.
Output:
![Check a number](http://techyrick.com/wp-content/uploads/2021/11/2021-11-06-18_40_33-GDB-online-Debugger-_-Compiler-Code-Compile-Run-Debug-online-C-C-and-3-m.webp)
Source Code: Using Nested if
Here also, I did the same as before but it is nested if else statement.
Output:
![Check a number](http://techyrick.com/wp-content/uploads/2021/11/2021-11-06-18_43_21-GDB-online-Debugger-_-Compiler-Code-Compile-Run-Debug-online-C-C-and-3-m.webp)
Below is a run option where you can run the program ????????
Also Read: Heads or tails in python full tutorial
Also Read: Random module in python