def calculate_grade(grade): if grade > 80: letter = "A" elif grade > 70: letter = "B" elif grade > 60: letter = "C" elif grade > 50: letter = "D" return letter