Calculate GPA
calculate_gpaComputes term and cumulative GPA from course credits and grades, including weighted courses, dropped or replaced attempts, and transcript CSV input for academic planning.
Instructions
Calculate a GPA from a list of courses with credits and grades, optionally weighted with a credit multiplier on each course, and optionally combined with an earlier GPA and credit total. The GPA for the courses you pass is the term GPA, and adding earlier work with prior_gpa and prior_credits gives the cumulative GPA. Inputs: courses (each with credits greater than 0, a grade that is a letter like "B+" or a percentage like 87, and an optional credit_multiplier greater than 0 such as 1.1 for an AP class), a scale id, and optional prior_gpa and prior_credits to fold in earlier terms. A credit_multiplier above 1 gives a course more weight in the weighted GPA, and when any course has one other than 1 the tool also returns weighted_gpa and weighted_credits. The term GPA still uses the plain credits. Pass drop_lowest to leave the lowest graded courses out of the GPA, as schools do that drop the lowest course; the dropped courses are named in dropped_courses. Pass replace_repeats to count only the last listed attempt of a course that appears more than once, for schools that replace an earlier grade when a course is retaken; the replaced attempts are named in replaced_courses. Pass prior_gpa and prior_credits together, or leave both out. Passing only one of the two is an error, so the tool says which one is missing. Alternatively, pass transcript_csv as a CSV string with columns for course name, credits, grade and optional credit multiplier; a header row is optional, the columns can be in any order, and header names like Course Title, Final Grade and Credit Hours are read as the name, grade and credits columns. When courses is not given, transcript_csv is parsed and used as the course list. In transcript_csv, a P is read as pass, NP as not pass and W as withdrawn. Those rows are left out of the GPA and named in the answer, except where the scale gives the letter points, such as P on australia-hd. Example prompt: "What's my GPA if I got an A in 3 credits, a B+ in 4 credits and a C in 3 credits?"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | Grade scale id: "us4", "us4plus", "ontario-college", "uk-classification", "australia-hd" or "weighted-5.0". Defaults to "us4". Ask the student which one their school uses if unsure. | us4 |
| courses | No | The courses to include. Each needs credits (greater than 0) and a grade (a letter like "B+" or a percentage like 87). name is optional, and so is credit_multiplier (greater than 0), which gives a course more weight in the weighted GPA. Required when transcript_csv is not given. | |
| prior_gpa | No | GPA from earlier terms, 0 to 7. Pass this together with prior_credits to get a cumulative GPA. Passing only one of the two is an error. | |
| drop_lowest | No | Number of courses with the lowest grade points to leave out of the GPA, 0 or more, for schools that drop the lowest course. It must be less than the number of graded courses. Ties go to the course listed first. Defaults to 0. | |
| prior_credits | No | Credits from earlier terms, 0 or more. Pass this together with prior_gpa to get a cumulative GPA. Passing only one of the two is an error. | |
| transcript_csv | No | A CSV string with columns for course name, credits, grade and optional credit multiplier. A header row is optional, the columns can be in any order, and header names like Course Title, Final Grade and Credit Hours are read as the name, grade and credits columns. P, NP and W grades are left out of the GPA. When courses is not given, this is parsed and used as the course list. Example: "Course,Credits,Grade\nCalculus,4,A\nHistory,3,B+" | |
| replace_repeats | No | Set to true when a retaken course replaces the earlier grade. Courses with the same name (ignoring case and extra spaces) are one course, and only the last one listed counts in the GPA. Courses without a name are never matched. The replaced attempts come back in replaced_courses. Defaults to false. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scale | Yes | The scale id the courses were marked on. | |
| courses | Yes | One entry per graded course, in the order they were passed. | |
| credits | Yes | The credits of the graded courses in this call. | |
| term_gpa | Yes | The GPA for these courses alone. | |
| scale_name | Yes | The name of the scale the courses were marked on. | |
| gpa_credits | Yes | The credits that count in the GPA, the same graded credits the term GPA is divided by. Excluded courses add nothing here. | |
| weighted_gpa | No | The GPA with each course's credits multiplied by its credit_multiplier, when at least one multiplier other than 1 was passed. It covers the courses in this call, not the earlier terms. | |
| cumulative_gpa | No | The GPA with the earlier terms folded in, when prior_gpa and prior_credits were both passed. | |
| dropped_courses | Yes | Courses left out because of drop_lowest. Empty when drop_lowest is 0 or not passed. | |
| excluded_courses | Yes | Courses left out of the GPA because they are not graded, such as P, NP and W rows in transcript_csv. Empty when none were left out. | |
| replaced_courses | Yes | Earlier attempts left out because replace_repeats was true and the course was listed again later. Empty when replace_repeats is false or not passed. | |
| weighted_credits | No | The credits after the credit multipliers are applied, when at least one multiplier other than 1 was passed. | |
| cumulative_credits | No | The credits of these courses and the earlier terms together, when prior_gpa and prior_credits were both passed. |