Dremendo Tag Line

Check a number is positive or not in Python

if else - Question 2

In this question, we will see how to check if a number is a positive number or not in Python programming using the if else statement. To know more about if else statement click on the if else statement lesson.

Q2) Write a program in Python to input a number and check if it is a positive number or not. A positive number is a number which is greater than 0.


n=int(input('Enter a number '))

if n>0:
    print('Positive Number')
    print('Not Positive Number')


Enter a number 5
Positive Number