fork download
  1. # 定义学生成绩列表
  2. student_score = [78, 65, 92, 78, 90, 45, 83, 57, 96, 56]
  3. # 定义总成绩变量
  4. sum_score = 0
  5. # 遍历 求总成绩
  6. for score in student_score :
  7. # 累加成绩
  8. sum_score += 1
  9. # 定义平均成绩变量
  10. avreage_score = sum_score / len(student_score)
  11. # 打印总成绩和平均成绩
  12. print(f'总成绩为:{sum_score} , 平均成绩为:{ avreage_score} ')
  13.  
Success #stdin #stdout 0.07s 7908KB
stdin
Standard input is empty
stdout
总成绩为:10			, 平均成绩为:1.0