Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created August 30, 2021 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pamelafox/b15efa154ecf33ec78012e759575c1a2 to your computer and use it in GitHub Desktop.
Save pamelafox/b15efa154ecf33ec78012e759575c1a2 to your computer and use it in GitHub Desktop.
Grade Assigner
"""
Write a function named assign_grade that:
* takes 1 argument, an integer representing the score.
* returns a grade for the score, either "A" (90-100), "B" (80-89), "C" (70-79), "D" (65-69), or "F" (0-64).
Call that function for a few different scores and log the result to make sure it works.
"""
def assign_grade(score):
"""
>>> assign_grade(95)
'A'
>>> assign_grade(90)
'A'
>>> assign_grade(85)
'B'
>>> assign_grade(80)
'B'
>>> assign_grade(77)
'C'
>>> assign_grade(70)
'C'
>>> assign_grade(68)
'D'
>>> assign_grade(65)
'D'
>>> assign_grade(64)
'F'
>>> assign_grade(0)
'F'
"""
return ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment