<p>下面是一个简短的医生计划,我正在做,这是一个开始,不幸的是,它不起作用。这是我收到的错误-
TypeError:输入最多应有1个参数,但得到4个</p>
<pre><code>least = 0
most = 100
while True:
try:
levelofpain = int(input("How much is it hurting on a scale of", (least), "to", (most)))
while llevelofpain < least or levelofpain > most:
print ("Please enter a number from", (least), "to", (most))
levelofpain = int(input("How much is it hurting on a scale of", (least), "to", (most)))
break
except ValueError:
print ("Please enter a number from", (least), "to", (most))
</code></pre>
<p>提前谢谢!在</p>
<p>p.s.使用Python3.3</p>
<p>错误消息是不言自明的:您正在向<code>input(...)</code>传递四个参数,而它只接受一个参数。在</p>
<p>解决方法是将参数转换为单个字符串。在</p>
<pre><code>levelofpain = int(input(
"How much is it hurting on a scale of {} to {}? ".format(least, most)))
</code></pre>