Home CPSC 110

Lab 4: Grade Calculator



To gain experience writing programs which use if, elif and else.



For this lab, you'll be creating a program that converts number grades to letter grades. For instance, if the input to the program is 88.5, the program should output B+.

According to the syllabus for this class, this is the grade breakdown:

This is written using mathematical "range notation". A "[" means that is the staring point for a range and it includes that value. A ")" means that is the ending point for a range but it does not include that value itself.

For example, to get a B+, you need an 87 or higher, up to a 90, but not including a 90 (which is an A-). So even a 89.999 would count as a B+.



  1. Start by asking the user what their numerical grade is, reading it in as a float (because it can have a fractional part).
  2. Use if, elif, and else statements to test the conditions for each letter grade. In each statement, you can print out the letter grade they receive.
  3. The program should only ever print 1 grade each time you run it. So if you run it twice, it can print different grades, but shouldn't ever print two for the same input.
  4. There are multiple ways of solving this sort of problem. I'd recommend starting a one side or the other (A or F), and checking them in order with one "if", multiple "elif" and then one "else".
  5. Be sure to test your program thoroughly, ideally testing each letter grade.



When you are finished, please submit the .py file for the lab on Canvas. To do so, you'll need to navigate to where you saved the file on your computer.

Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.