In this python if else program, we will check whether the given number is positive or not.
Positive number:
A positive number is any number greater than zero. Positive number includes natural numbers.
Steps to solve the program
- Take a number as input through the user.
- If the number is positive then print True, else print False.
- Use an if-else statement for this purpose.
- Print the output.
num = int(input("Enter a number: "))
if num>0:
print("True")
else:
print("False")
Output :
Enter a number: 20
True
Related Articles
Python program to check whether the given number is negative or not.
Python program to check whether the given number is positive or negative and even or odd.
Python program to print the largest number from two numbers.
Python program to check whether a given character is uppercase or not.
Python program to check whether the given character is lowercase or not.
Python program to check whether the given number is an integer or not.