擅长:python、mysql、java
<p>这应该能奏效</p>
<pre class="lang-py prettyprint-override"><code>total = 0
for i in range(10):
score = int(input("Enter a score between 0 and 100: "))
if score >= 89:
print("The grade is an A")
elif score >= 79:
print("The grade is a B")
elif score >= 69:
print("The grade is a C")
elif score >= 59:
print("The grade is a D")
else:
print("The grade is a F")
total += score
print("Average of all 10 students:", total/10)
</code></pre>
<p>在<code>for</code>循环中,您获得每个学生的分数,然后将其添加到所有学生的总数中。循环结束后,将其除以学生总数,因此<strong>10</strong></p>
<p><code>total score / total number of students</code><strong><code>total / 10</code></strong></p>