95.9k views
3 votes
write a program that prompts the instructor to enter the student's name and the number of average grades to calculate for each student the instructor then enters through his name and three grades for each student and calculate the average then display the student name the three grades enter and the student average. (Separate each student info with a blank line.)​

User Mbourgon
by
7.9k points

1 Answer

3 votes

Final answer:

To write a program that prompts the instructor to enter the student's name and the number of average grades to calculate, you can use a loop to repeat the process for each student.

Step-by-step explanation:

To write a program that prompts the instructor to enter the student's name and the number of average grades to calculate, you can use a loop to repeat the process for each student. Here is an example:

num_students = int(input('Enter the number of students: '))

for i in range(num_students):
name = input('Enter student's name: ')
num_grades = int(input('Enter the number of grades: '))
grades = []
for j in range(num_grades):
grade = float(input(f'Enter grade {j+1}: '))
grades.append(grade)
average = sum(grades) / num_grades
print(f'Student Name: {name}')
print(f'Grades: {grades}')
print(f'Average: {average}')
print() # Print a blank line

This program allows the instructor to enter the student's name, the number of grades to calculate, and the actual grades. It then calculates the average of the grades and displays the student's name, the individual grades entered, and the average.

User Mankoff
by
7.0k points