You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
972 B
37 lines
972 B
# 输入学生姓名和三科成绩
|
|
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)
|