gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
format as a code block my next prompt
- User
format as a code block my next prompt
- Assistant
Prompt:
Create a function called
calculate_gpathat takes in a dictionary where the keys are course names and the values are the corresponding grades (in the form of a string letter grade, e.g. "A-" or "C+"). The function should return the calculated GPA as a float, where an "A" is worth 4.0, "A-" is worth 3.7, "B+" is worth 3.3, etc.Example usage:
>>> grades = {"Math": "B+", "Science": "A-", "History": "C"} >>> calculate_gpa(grades) 2.7