total_score=0
total_credit=0
for i in range(20):
    _, score,credit = input().split()
    if credit=='A+':
        credit=4.5
    elif credit=='A0':
        credit=4.0
    elif credit=='B+':
        credit=3.5
    elif credit=='B0':
        credit=3.0
    elif credit=='C+':
        credit=2.5
    elif credit=='C0':
        credit=2.0
    elif credit=='D+':
        credit=1.5
    elif credit=='D0':
        credit=1.0
    elif credit=='F':
        credit=0.0
    elif credit=='P':
        break
    total_credit += (float(score) * credit)

total_score+=(total_credit/20)
print(total_score)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: