def readInput(prompt): """Reads in one line of text from the user repeating the prompt if they don't enter any text""" input = "" while input == "": input = raw_input(prompt) return input def getAverageGrade(prompt,count): """Reads count grades from the user, and returns the average. prompt defines what type of grade. >>>getAverageGrade("Exam", 3) Exam 1 score: 80 Exam 2 score: 90 Exam 3 score: 85 85.0 """ total = 0 for i in range(count): total += float(readInput(prompt + " " + str(i+1) + " score:")) return total/count count = int(readInput("How many students' grades do you want to calculate?")) for i in range(count): total = 0 name = readInput("Enter the student's name: ") print "Enter the student's exam grades" total += .6 * getAverageGrade("Exam", 3) print "Enter the student's assignment grades" total += .4 * getAverageGrade("Assignment", 4) print name + "'s total grade is " + str(total)