def average_grade(grade_list): '''Return the average grade (a float) for all of the students in the list of lists grade_list, where the inner lists contain a student ID (a str) and a grade (a number).''' total_grade = 0.0 for student in grade_list: total_grade = total_grade + student[1] return total_grade / len(grade_list) def get_student_IDs(grade_list): '''Return a list of strs containing the student IDs from the list of lists grade_list, where the inner lists contain a student ID (a str) and a grade (a number).''' ID_list = [] for student in grade_list: ID_list.append(student[0]) return ID_list if __name__ == '__main__': student_grades = [['999888777', 78], ['111222333', 90], ['444555666', 83]] a = average_grade(student_grades) print "About to print the average of the student grades in" print student_grades print "which is a list of lists, where each inner list" print "contains a student number and a grade" print a, "should be",83.666666666666671 raw_input("Enter 1 to move on ") ids = get_student_IDs(student_grades) print "About to print a list of only the student ids" print ids, "should be", ['999888777', '111222333', '444555666']