猫史档案馆


【PYTHON】学生成绩评价(网页端)

用户:KIHIOKIHIO查看:1 回复:1 评论:1 创建时间:2021-07-10T19:36:39


只要输入您的语文、数学、英语成绩,系统就会对成绩评分。

成绩评分标准(数字以成绩和为准):

295+:A+

290~294:A

280~289:B

270~279:C

255~269:D

235~254:E

200~234:F

199-:F-

偏科程度评分标准(数字以最高成绩减去最低成绩为准):

3-:A+

3~7:A

7~10:B

11~16:C

17~25:D

26~35:E

36~50:F

51+:F-

总评分以两个评分中最低评分为准。

源代码:

#开始进入Python的世界
while True:
    print("请输入语文成绩:")
    try:
        chinese=float(input())
    except ValueError:
        print("输入错误,请重试。")
        continue
    print("请输入数学成绩:")
    try:
        maths=float(input())
    except ValueError:
        print("输入错误,请重试")
        continue
    print("请输入英语成绩")
    try:
        english=float(input())
    except ValueError:
        print("输入错误,请重试")
        continue
    if (((chinese>=0 and chinese<=100) and (maths>=0 and maths<=100)) and (english>=0 and english<=100)):
        break
    else:
        print("输入错误,请重试")
cme=chinese+maths+english
if cme>=295:
    a=7
elif cme>=290:
    a=6
elif cme>=280:
    a=5
elif cme>=270:
    a=4
elif cme>=255:
    a=3
elif cme>=235:
    a=2
elif cme>=200:
    a=1
else:
    a=0
if chinese>=maths and chinese>=english:
    high=chinese
elif maths>=chinese and maths>=english:
    high=maths
else:
    high=english
if chinese<=maths and chinese<=english:
    low=chinese
elif maths<=chinese and maths<=english:
    low=maths
else:
    low=english
if (high-low)<=3:
    b=7
elif (high-low)<=7:
    b=6
elif (high-low)<=10:
    b=5
elif (high-low)<=16:
    b=4
elif (high-low)<=25:
    b=3
elif (high-low)<=35:
    b=2
elif (high-low)<=50:
    b=1
else:
    b=0
if a>b:
    c=b
else:
    c=a
if c is 7:
    print("A+")
elif c is 6:
    print("A")
elif c is 5:
    print("B")
elif c is 4:
    print("C")
elif c is 3:
    print("D")
elif c is 2:
    print("E")
elif c is 1:
    print("F")
else:
    print("F-")

可以将代码拷贝黏贴到海龟编辑器网页端进行测试。


回复

上一页1 页 / 共 1下一页
冷鱼闲风冷鱼闲风

继续加油!

点赞1


评论