ADD file via upload

main
nwnu202232001103 5 months ago
parent 2cf24a8638
commit 861ad80a1d

@ -0,0 +1,36 @@
# 输入学生姓名和三科成绩
student_name = input("请输入学生姓名:")
subject1 = float(input("请输入第一科成绩:"))
subject2 = float(input("请输入第二科成绩:"))
subject3 = float(input("请输入第三科成绩:"))
# 计算总分
total_score = subject1 + subject2 + subject3
# 确定等级
if total_score >= 270:
grade = "A"
elif total_score >= 240:
grade = "B"
elif total_score >= 210:
grade = "C"
elif total_score >= 180:
grade = "D"
else:
grade = "F"
# 确定是否及格
passing_grade = 180 # 及格线
if total_score >= passing_grade:
passing_status = "及格"
else:
passing_status = "不及格"
# 输出结果
print("学生姓名:", student_name)
print("第一科成绩:", subject1)
print("第二科成绩:", subject2)
print("第三科成绩:", subject3)
print("总分:", total_score)
print("等级:", grade)
print("是否及格:", passing_status)
Loading…
Cancel
Save