WAP to input a no and chick whether it is a
triple ser nore than 3 digit
number
single, double
Answers
Answered by
11
n = input("Enter a number: ")
if len(n) == 1:
print("It is a 1 - digit number.")
elif len(n) == 2:
print("It is a 2 - digit number. ")
elif len(n) == 3:
print("It is a 3 - digit number.")
else:
print("It is a number of more than 3 digits.")
Here, we've made use of the len function.
- The len function counts the number of characters given.
We've also made use of the if-elif-else conditional statement.
- They're statements that check for a given expression, and if it results to true, the required output is produced.
Similar questions