题解 | #牛牛的绩点#

牛牛的绩点

https://www.nowcoder.com/practice/de8bc3e736164786b07a4dd64ed172f7

total = 0
a = 0
while True:
    l = input()
    if l == 'False':
        break
    g = int(input())
    if l == "A":
        grade = g * 4
    elif l == "B":
        grade = g * 3
    elif l == "C":
        grade = g * 2
    elif l == "D":
        grade = g * 1
    elif l == "F":
        grade = g * 0

    total += grade
    a += g
print('{:.2f}'.format(total / a))
全部评论

相关推荐

评论
4
收藏
分享
牛客网
牛客企业服务