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")
2 Answers
+ 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
+ 1
The try block should contain code that might throw an exception. In your code, it is not fulfilled.