我正在創建一個簡單的Python程序,要求提供有關用戶的基本信息。如果基本信息輸入中的語句錯誤
myAge= input()
if myAge > 20:
print ('You must be old enough to party legally now.')
else:
print ('Put that drink down!')
我的錯誤
if myAge > 20: TypeError: '>' not supported between instances of 'str' and 'int'
非常酷的另外,謝謝!現在,我如何查看我可以使用的功能以及它們的工作方式。例如查找什麼嘗試:手段或什麼破解等手段。 – SplendidMallard
Python教程是一個有用的參考 - https://docs.python.org/3.6/tutorial/errors.html(並解釋了相同的例子,事實上...)。你仍然可以谷歌任何你需要的,你會發現很多答案! –