# Write a program that uses the following menu to keep track of student information: 1) Enter a student 2) Quit If the user chooses 1, prompt the user to enter a grade level (to be chosen from the given menu) and a test score. Keep track of the following: • Total number of Freshmen, Sophomores, Juniors, and Seniors • Total number of students entered • Total of all test scores entered When the user chooses to quit, calculate: • The percentage of students that fall into each category • The average of all the test scores entered Display your results as shown. Input validation: • The user must choose valid options from the menus. • The user must enter a test score between 0 and 100.

Question
1 views

Write a program that uses the following menu to keep track of student information: 1) Enter a student 2) Quit If the user chooses 1, prompt the user to enter a grade level (to be chosen from the given menu) and a test score. Keep track of the following: • Total number of Freshmen, Sophomores, Juniors, and Seniors • Total number of students entered • Total of all test scores entered When the user chooses to quit, calculate: • The percentage of students that fall into each category • The average of all the test scores entered Display your results as shown. Input validation: • The user must choose valid options from the menus. • The user must enter a test score between 0 and 100.

check_circle

Python program to keep track of student information

Program Intro

Create a menu using printf() function and use while loop to show the menu repeatedly. Create a variable “choice” to input user’s choice between 1 and 2. Create lists grade_level and test_score to store input choices from 1 to 4. Use list grade_level and function len() to show the total number of students. Use sum() function with len() function to calculate average score. Use if-elif conditions to count the number freshman, sophomore, junior and senior students and also their percentage of falling into each category.

Program

print("\nWELCOME TO THE STUDENT SURVEY!!\n")

# lists for keeping track

while True:

print("\t1) Enter Student Information")

print("\t2) Quit")

ch = input("\nEnter your choice here: ")

choice = int(ch)

if choice == 2:      print("Good bye.")

break

elif choice != 1:

# input validation

print("Invalid selection. You must choose 1 or 2 from the menu.")

print("\t1) Freshman")

print("\t2) Sophomore")

print("\t3) Junior")

print("\t4) Senior")

gra = input("\nEnter the grade level here: ")

# input validations

while True:

test_s = input("Enter the test score: ")

test = int(test_s)

if test <0 or test>100:

print("Invalid test score. Must be between 0 and 100.\n")

else:

test_score.append(test)

break

# displaying total students and their average

print("\nAverage test score:\t",sum(test_score)/len(test_score))

&...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in