给出百分制成绩要求输出成绩等级A、B、C、D和E。评定的依据:90~100分为A80~89分为B70~79分为C60~69分为D低于60分为E。请应用switch语句编写算法实现。
score = int(input("请输入成绩(百分制):"))
grade = ''
if score >= 90:
grade = 'A'
elif score >= 80:
grade = 'B'
elif score >= 70:
grade = 'C'
elif score >= 60:
grade = 'D'
else:
grade = 'E'
print("成绩等级为:", grade)
原文地址: https://www.cveoy.top/t/topic/eCRG 著作权归作者所有。请勿转载和采集!