Answer to Question #172914 in Python for David Lunani

Question #172914

Write a program that asks the user for a number between 10 and 30 inclusive and will validate, that is test, the input. It should repeatedly ask the user for this number until the input is within the valid range.


1
Expert's answer
2021-03-18T08:33:53-0400
while True:
    number = int(input('Enter a number between 10 and 30 with 10 and 30 inclusive'))
    if number < 10 or number > 30:
        print('Enter correct number')
    else:
        print(number)
        break

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS