+ 1
This can be done using "exception handling," found in the section of the app "Exceptions and Files". Refer to that for more information. If you haven't yet reached it I wouldn't worry about it, but you could always look up more online!
Here's the revised code to create an exception to the ValueError (when the input is not an integer):
while True:
    try:
        x = int(input("Enter number: "))
        while x <= 30:
            print(x)
            x = x + 1
        if x >= 30:
            print("Finished")
            quit()
    
    except(ValueError):
        print('Error, not a valid number. Try again...')
I hope that helps! I know I changed around in the code though, lmk if you have questions. Good luck!
0
there is also isdigit which checks to see if something is a digit that can help.




