第一遍没搞明白怎么输出的,没用字典的笨办法
牛牛的绩点
https://www.nowcoder.com/practice/de8bc3e736164786b07a4dd64ed172f7
a = []
while True:
num = input()
if num=='False':
break
else:
a.append(num)
b = 0
c = 0
for i in range(0, len(a),2):
if a[i] == 'A':
b += int(a[i+1])*4.0
c += int(a[i+1])
elif a[i] == 'B':
b += int(a[i+1])*3.0
c += int(a[i+1])
elif a[i] == 'C':
b += int(a[i+1])*2.0
c += int(a[i+1])
elif a[i] == 'D':
b += int(a[i+1])*1.0
c += int(a[i+1])
elif a[i] == 'F':
b += int(a[i+1])*0
c += int(a[i+1])
else:
break
num = b/c
print('%.2f'%num)
while True:
num = input()
if num=='False':
break
else:
a.append(num)
b = 0
c = 0
for i in range(0, len(a),2):
if a[i] == 'A':
b += int(a[i+1])*4.0
c += int(a[i+1])
elif a[i] == 'B':
b += int(a[i+1])*3.0
c += int(a[i+1])
elif a[i] == 'C':
b += int(a[i+1])*2.0
c += int(a[i+1])
elif a[i] == 'D':
b += int(a[i+1])*1.0
c += int(a[i+1])
elif a[i] == 'F':
b += int(a[i+1])*0
c += int(a[i+1])
else:
break
num = b/c
print('%.2f'%num)