너의 평점은
import sys
def main():
input = sys.stdin.readline
total_credit = 0.0
total_grade = 0.0
for _ in range(20):
args = input().split()
credit = float(args[1])
grade = args[2]
if grade == "P":
continue
grade_letters = ["A+", "A0", "B+", "B0", "C+", "C0", "D+", "D0", "F"]
grade_values = [4.5, 4.0, 3.5, 3.0, 2.5, 2.0, 1.5, 1.0, 0.0]
grade_value = grade_values[grade_letters.index(grade)]
credit_sum += credit
grade_sum += credit * grade_value
main()
댓글