题解 | #牛牛的绩点#

牛牛的绩点

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

from dataclasses import make_dataclass
a=[]
b=[]
i=0
under=0
score=[]
total=0
while True:
    temp=input()
    if temp=='False':
        break
    else:
        if i%2==0:
            a.append(temp)
        else:
            b.append(int(temp))
    i+=1
m=0
for i in a:
    if i=='A':
        score.append(4*b[m])
        under+=b[m]
        m+=1
    elif i=='B':
        score.append(3*b[m])
        under+=b[m]
        m+=1
    elif i=='C':
        score.append(2*b[m])
        under+=b[m]
        m+=1
    elif i=='D':
        score.append(1*b[m])
        under+=b[m]
        m+=1
    else:
        score.append(0*b[m])
        under+=b[m]
        m+=1
#print(a,b,sep='\n')
##print(score)
for i in score:
    total+=i
#print(total)
#print(under)
print(f'{(total/under):.2f}')
#print('%.2f'%(total/under))


最愚笨的方法

全部评论

相关推荐

仁者伍敌:实习生要工作经验,工作要实习经验
点赞 评论 收藏
分享
06-14 19:09
门头沟学院 Java
darius_:给制造业搞的,什么物料管理生产管理,设备管理点检,最最关键的就是一堆报表看板。个人觉得没啥技术含量都是些基本的crud,但是业务很繁琐那种
点赞 评论 收藏
分享
05-23 20:31
已编辑
武汉大学 Java
内向的柠檬精在研究求...:注意把武大标粗标大 本地你俩不是乱杀
实习进度记录
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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