Get average grade for 10 students - python
<p>I have a program that asks a user to enter a Student NETID and then what grades they got on 5 assignments plus the grade they got on the mid-term and final. It then adds them and divides to get that students average grade which displays in table format.</p>

<p>What I need to do, is loop through that whole process 9 more times. So essentially, Ill be asking 9 more students the same input, which then Ill need to display in the table format.</p>

<p>My question is how would I loop through the process that I have right now 'x' amount of times, then display the average of all students.</p>

<p>This is my code right now:</p>

<pre><code>   # x holds the list of grades
   x = []

   # count of assignments 
   assignments = 5

   # Ask for a student ID from user
   NETID = int(input('Enter your 4 digit student NET ID: '))

   # fill list with grades from console input
   x = [int(input('Please enter the grade you got on assignment {}: '.format(i+1))) for i in     range(assignments)]

   midTermGrade = int(input('Please enter the grade you got on you Mid-Term: '))
   finalGrade = int(input('Please enter the grade you got on you Final: '))

   # count average, 
   average_assignment_grade = (sum(x) + midTermGrade + finalGrade) / 7 

   print()
   print('NET ID \t Average Final Grade')
   print('---------------------------------')

   for number in range(1):
      print(NETID, '\t\t', format(average_assignment_grade, '.1f'),'%')

main()
</code></pre>

<p>And this is how it looks on console:</p>

<p><a href="http://i.stack.imgur.com/0g2C2.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/0g2C2.jpg" alt="My Python Program"></a></p>

<p>You really did the hardest part. I don't see why you couldn't so the loop of the average. Anyway:</p>

<pre><code>student_count = 5;
A = [student_count]

for id_student in range(student_count):    
    print("STUDENT #", id_student+1)

    # x holds the list of grades
    x = []

    # count of assignments 
    assignments = 5

    # Ask for a student ID from user
    NETID = int(input('Enter your 4 digit student NET ID: '))

    # fill list with grades from console input
    x = [int(input('Please enter the grade you got on assignment {}: '.format(i+1))) for i in     range(assignments)]

    midTermGrade = int(input('Please enter the grade you got on you Mid-Term: '))
    finalGrade = int(input('Please enter the grade you got on you Final: '))

    # count average, 
    average_assignment_grade = (sum(x) + midTermGrade + finalGrade) / 7 

    print()
    print('NET ID | Average Final Grade')
    print('---------------------------------')

    for number in range(1):
        print(NETID, " | ", format(average_assignment_grade, '.1f'),'%')

    A.append(average_assignment_grade);

grades_sum = sum(A)
grades_average = grades_sum / 5;
print("SUM OF ALL STUDENTS = " + grades_sum)
print("AVERAGE OF ALL STUDENTS = " + grades_average)
</code></pre>

<p><strong>Update:</strong> As suggested above, you should make a function for a single student and loop through that function in another, since SO is not a coding service I won't do that for you, but I think you got the idea.</p>

python loops