题解 | #牛牛的绩点#

牛牛的绩点

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

x=''
dict={'A':4.0,'B':3.0,'C':2.0,'D':1.0,'F':0}
list=[]
result,even=0,0
i=0
while True:
    x=input()
    if x in dict.keys():
        list.append(dict[x])
    elif x=='False':
        break
    else:
        list.append(int(x))

for j in range(len(list)//2):
    result += list[i]*list[i+1]
    even += list[i+1]
    i += 2
    
print('%.2f'%(result/even))

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务