202k views
5 votes
Write a program that prompts the instructor to enter the students' name and the number of average grades to calculate for each student. The instructor then enters student name and 3 grades for each student and calculate the average. Then displays the student namr, the 3 grades entered, and the student average. (Separate each student info with a blank line.)​

User Regressor
by
7.4k points

1 Answer

2 votes

Final answer:

To write a program that prompts the instructor to enter the students' names and calculate average grades for each student, use a loop to iterate through the number of students. Prompt the user for the student's name and grades, and calculate the average grade. Print the student's name, grades, and average grade.

Step-by-step explanation:

To write a program that prompts the instructor to enter the students' names and the number of average grades to calculate for each student, you can use a loop to iterate through the number of students. Within each iteration, prompt the user to enter the student's name and grades. Calculate the average grade by summing up the grades and dividing by the number of grades. Finally, display the student's name, the grades entered, and the average grade.

Here's an example in Python:

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

for i in range(num_students):
name = input('Enter the student name: ')
grades = []
for j in range(3):
grade = float(input(f'Enter grade {j+1} for {name}: '))
grades.append(grade)
average_grade = sum(grades) / len(grades)

print(f'Student Name: {name}')
print(f'Grades Entered: {grades}')
print(f'Average Grade: {average_grade}')
print() # Blank line

User MattMS
by
7.7k points