Commit f6ae9e8f authored by Fabian Benc's avatar Fabian Benc
Browse files

Added While Exercises solutions

parent a264a708
"""The program should ask the user to enter a number in the range of 10-20.
If the user guesses the span; print: congratulations-you entered a number in the range and print the number the user entered.
If the user does not guess the number, print: the number is not in the range of 10-20; Please try again. The loop is executed as long as the condition is TRUE or the user enters higher numbers from zero.
If the user enters 0, program execution is interrupted. """
while True:
num = int(input("Enter a number in the range 10 - 20: "))
if num >= 10 and num <= 20:
print("Congratulations, you entered the number in the given range.", num)
elif num == False:
print("Number is not in the range from 10 to 20.")
print("Please try again.")
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment