I'm trying to make this function return a string (the letter grade) instead of the float number but I've been stuck for hours. Yes they need to be floats. I know it seems a little messy right now I'm just trying to get it to work before I move onto cleaning it up.
def main(): test_score_1 = float(input('Enter test score #1: ')) test_score_2 = float(input('Enter test score #2: ')) test_score_3 = float(input('Enter test score #3: ')) test_score_4 = float(input('Enter test score #4: ')) test_score_5 = float(input('Enter test score #5: ')) print() print('Results:') determine_grade(test_score_1) determine_grade(test_score_2) determine_grade(test_score_3) determine_grade(test_score_4) determine_grade(test_score_5) print('Test #1:', test_score_1) print('Test #2:', test_score_2) print('Test #3:', test_score_3) print('Test #4:', test_score_4) print('Test #5:', test_score_5) def determine_grade(score): if score >= 90.0: return 'A' elif score >= 80.0: return 'B' elif score >= 70.0: return 'C' elif score >= 60.0: return 'D' elif score >= 50.0: return 'F' main()
determine_grade(x)test_score_1 = determine_grade(test_score_1). You could use other variables, or whatever you want.