GPA Calculator (optional)

This is an optional assignment to give you more experience with the topics of lesson one. Like the tip-calculator this assignment provides real-world application.

Setup

Fork and clone the lesson one homework repository (if you didn't already for the tip calculator assignment).

Lesson 1 Homework

Open the gpa-calculator.py file in your text editor.

Requirements

Write a program that does the following:

  • create a variable for each class you want to include (biology, geometry, etc)

  • create variables storing the credits for each grade

a = 4
a_minus = 3.7
...
  • ask the user what letter grade they received for each class you chose to

    include

  • calculate the points for each grade by multiplying the user's provided value

    with the credits associated with that letter grade

if (biology == 'a-'):
  biology_points = a_minus * biology ...
  • keep track of the total points and the total credits

  • calculate the GPA: total_points / total_credits

  • print your cumulative GPA

Tips

  1. You might notice that this program requires that you repeat very similar code

    for each class you selected. Functions and loops make it so you don't have to

    repeat yourself so much. For now, don't worry too much about the repetition.

    You might not want to select too many classes right now though.

  2. Use the following table (or some variation) to calculate the number of points to

    award each grade:

Last updated