Python: Check if a number is positive, negative or zero
Resolve Path Name
Write a Python program to check if a number is positive, negative or zero.
Positive Numbers: Any number above zero is known as a positive number. Positive numbers are written without any sign or a '+' sign in front of them and they are counted up from zero, i.e. 1, + 2, 3, +4 etc.
Negative Numbers: Any number below zero is known as a negative number. Negative numbers are always written with a '−' sign in front of them and they are counted down from zero, i.e. -1, -2, -3, -4 etc.
Always look at the sign in front of a number to check if it is positive or negative.
Zero, 0, is neither positive nor negative.
Pictorial Presentation:

Sample Solution-1:
Python Code:
Sample Output:
Input a number: 150 It is positive number
Flowchart:

Sample Solution-2:
Python Code:
Sample Output:
Input a number: 0 It is Zero!
Sample Solution-3:
Python Code:
Sample Output:
Input a number: -150 Number is Negative number.
For more Practice: Solve these Related Problems:
- Write a Python program to resolve a symbolic link to its real path.
- Write a Python program to get the canonical path of a given file.
- Write a Python program to normalize a given file path.
- Write a Python program to check if a path exists before resolving it.
Go to:
Previous: Write a Python program to find path refers to a file or directory when you encounter a path name.
Next: Write a Python program to get numbers divisible by fifteen from a list using an anonymous function.
Python Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.