Check 2 digit positive number in Python
if else - Question 7
In this question, we will see how to check if a number is a two digit 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.
Q7) Write a program in Python to input a number and check if it is a two digit positive number or not. All number starting from 10 to 99 are two digit positive numbers. Make use of logical operator (and) to solve this question.
Program
n=int(input('Enter a number '))
if n>=10 and n<100:
print('Two digit positive number')
else:
print('Not two digit number')
Output
Enter a number 54 Two digit positive number