0

Else and exception handling-Ordering dish online with digits-only code

This code works excepts when user enters 135H. I get message:"Value Error: invalid literal for int() with base 10.....I'm a bit....short of ideas....Anyone can please help?(I have tried coding with a pattern and it didn't work either) code =int(input()) #your code goes here try: print("Order accepted") except TypeError: print("Enter only digits") else: print("Bon appetit")

27th Feb 2022, 4:46 PM
Cathyboum
2 odpowiedzi
+ 1
Please do not re-post the same question. If you want to add something, post in the existing thread. https://www.sololearn.com/Discuss/2991451/?ref=app
27th Feb 2022, 4:56 PM
Lisa
Lisa - avatar
+ 1
The try block should contain code that might throw an exception. In your code, it is not fulfilled.
27th Feb 2022, 5:24 PM
JaScript
JaScript - avatar