Javatpoint Logo
Javatpoint Logo

Python Program to check if a Number is Positive, Negative or Zero

We can use a Python program to distinguish that if a number is positive, negative or zero.

Positive Numbers: A number is known as a positive number if it has a greater value than zero. i.e. 1, 2, 3, 4 etc.

Negative Numbers: A number is known as a negative number if it has a lesser value than zero. i.e. -1, -2, -3, -4 etc.

Python Condition And Loops1

See this example:

Output:

Python Condition And Loops2

Note:In the above example, elif statement is used. The elif statement is used to check multiple expressions for TRUE and executes a block of code when one of the conditions becomes TRUE.

It is always followed by if statement.





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA