user_input = input('How old are you?: ')
if user_input >= 18:
print('You are an adult')
elif user_input < 18:
print('You are quite young')
except ValueError:
print('Please type in an integer')
它说,在除了的Python除了ValueError异常:
语法错误,请帮助。
您只能在'try'中使用'except'。 [见这些Python文档。](https://docs.python.org/3/tutorial/errors.html#handling-exceptions) –
正如我在你的[上一个问题]中所述(http://stackoverflow.com/questions/33977659/how-do-i-compare-a-string-and-an-integer-in-python),_please阅读[官方Python教程](https://docs.python.org/3.4/tutorial/index的.html)_。 – TigerhawkT3
会检查出来,谢谢 – Keretto