<p>在您的while之前有一行无用的代码,可以删除:</p>
<pre><code>celsius = int(input("Enter the temperature of everyday of the past 10 days in celsius: "))
</code></pre>
<p>以下是您的代码版本,可满足您的要求:</p>
<pre><code>def cold(temps):
count=0
for temperature in temps:
if temperature <50:count+=1
return count
def warm(temps):
count=0
for temperature in temps:
if temperature >=50 and temperature<85:count+=1
return count
# This program will convert 10 entries from celsius to farenheit
print('Lets convert the temperature from the past 10 day from celsius to farenheit')
print("")
# Create the open list and loop to prompt the user for all the temperatures in farenheit
temps = list()
while len(temps) != 10:
temps.append(celsius)
celsius = int(input("Enter the temperature of everyday of the past 10 days in celsius: "))
print("")
print("Okay, the temperature, in celsius of the past 10 days has been: ", temps)
print("")
# Using a for loop, convert each entry by the user into celsius and print the result
for far in range(len(temps)):
temps[far] = (temps[far] * 1.8) + 32
print("")
print ("The temperatures for everyday of the past week, converted into farenheit, is: ", temps)
print("")
print("number of cold days",cold(temps))
print("number of warm days",warm(temps))
</code></pre>