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:
Source Code: Using Nested if
Here also, I did the same as before but it is nested if else statement.
Output:
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