Given a number. The task is to check whether the number is positive or negative or zero.
Input: 5 Output: Positive Input: -5 Output: Negative
We will use the if-elif statements in Python. We will check whether the number is greater than zero or smaller than zero or equal to zero.
Below is the implementation.
Positive Equal to zero Negative
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.