擅长:python、mysql、java
<p>我附上了工作代码。
语法错误是由于缺少排列和错误的缩进造成的。看看你的<code>else:</code>语句。它与<code>try:</code>语句的高度不同。
TypeError的意思是,你不必把你的输入转换成字符串,因为它们已经是了。否则,我建议您创建一些变量,并在使用它们进行计算时通过<code>int()</code>转换它们</p>
<pre><code>while True:
try:
userInputOne = input("How much time in hours a week, do you spend practicing? ")
except TypeError:
print("Oops! Practice time must be rounded to the nearest integer. It also needs to be a numerical value! ")
break
else:
userInputTwo = input("How good to do want to be? Enter 'very good', 'good', mediocre, 'not good' ")
if userInputTwo not in ('very good', 'good', 'mediocre', 'not good'):
print("Please use one of the options. ")
else:
print("Let's calculate...")
break
</code></pre>
<p>编辑:
我建议使用PyCharm(如果你不这样做的话)的自动缩进功能和不错的“缩进准则”。所以你可以更容易地看到许多错误</p>