Created
November 10, 2012 17:09
-
-
Save pdpinch/4051746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ********** Exercise 2.8 ********** | |
import math | |
def report_card(): | |
##### YOUR CODE HERE ##### | |
count_classes = int(input("How many classes did you take? ")) | |
grade_book = {} | |
total = 0 | |
for i in range(count_classes): | |
name = input("What was the name of this class? ") | |
grade = input("What was your grade? ") | |
grade_book[name] = grade | |
total += grade | |
# print total | |
print "REPORT CARD:" | |
for course in grade_book: | |
print course, "-", grade_book[course] | |
print "Overall GPA ", round(float(total)/count_classes,2) | |
# report_card() | |
# Test Cases | |
## In comments, show the output of one run of your function. | |
##How many classes did you take? 3.01 | |
##What was the name of this class? 18.01 | |
##What was your grade? 97 | |
##What was the name of this class? 18.02 | |
##What was your grade? 97 | |
##What was the name of this class? 18.03 | |
##What was your grade? 98 | |
##REPORT CARD: | |
##18.01 - 97 | |
##18.02 - 97 | |
##18.03 - 98 | |
##Overall GPA 97.33 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment