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