I'm trying to learn about Pythons error handling and I've currently come across the Try and Except statements. I have found myself stuck with a problem. I need a User to enter an number between 0-24. If a number is not entered (i.e a string), I need to use except to print "not a number". If a number is entered and it is not between 0-24 I need to raise another error and print " not in range 0-24" Otherwise print "Valid number. I've been playing around with the code and I have ended up here.
error = False
try:
number = int(input("\nEnter an hour: "))
except ValueError:
print("\nNot an number.")
error = True
while error == false:
try:
if number <0 or number >24:
raise ValueError("number not between 0-24")
else:
print ("\nIts a number and its between 0-24")
Please Help or point me in the right direction:)