total = 0 gradeCounter = 0 grade = raw_input( "Enter grade, -1 to end: " ) # get one gradegrade = int( grade ) # convert string to an integerwhile grade != -1: total = total + grade gradeCounter = gradeCounter + 1 grade = raw_input( "Enter grade, -1 to end: " ) grade = int( grade )if gradeCounter != 0: average = float( total ) / gradeCounter print "Class average is", averageelse: print "No grades were entered"
Name (required)
email (will not be published) (required)
Website