Learn
Conditionals & Control Flow
The Big If

Really great work! Here’s what you’ve learned in this unit:

Comparators

3 < 4 5 >= 5 10 == 10 12 != 13

Boolean operators

True or False (3 < 4) and (5 >= 5) this() and not that()

Conditional statements

if this_might_be_true(): print "This really is true." elif that_might_be_true(): print "That is true." else: print "None of the above."

Let’s get to the grand finale.

Instructions

1.

In the workspace to your right, there is the outline of a function called grade_converter().

The purpose of this function is to take a number grade (1-100), defined by the variable grade, and to return the appropriate letter grade (A, B, C, D, or F).

Your task is to complete the function by creating appropriate if and elif statements that will compare the input grade with a number and then return a letter grade.

Your function should return the following letter grades:

  • 90 or higher should get an “A”
  • 80 - 89 should get a “B”
  • 70 - 79 should get a “C”
  • 65 - 69 should get a “D”
  • Anything below a 65 should receive an “F”
Folder Icon

Take this course for free

Already have an account?