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.
Python program to keep track of student information
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.
print("\nWELCOME TO THE STUDENT SURVEY!!\n")
# lists for keeping track
grade_level = test_score = 
print("\nPlease choose from the following menu:")
print("\t1) Enter Student Information")
ch = input("\nEnter your choice here: ")
choice = int(ch)
if choice == 2: print("Good bye.")
elif choice != 1:
# input validation
print("Invalid selection. You must choose 1 or 2 from the menu.")
continue print("\nPlease choose the grade level from the following menu:")
gra = input("\nEnter the grade level here: ")
grade = int(gra)
# input validations
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")
# displaying total students and their average
print("\nTotal number of students entered:\t",len(grade_level))
print("\nAverage test score:\t",sum(test_score)/len(test_score))
Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*See Solution
Q: In MS Access, what kind of data will be accepted into database using theinput mask \A\S\ 00\-99\-A;0...
A: Input mask:Input mask is used to specify what kind of data it will take in database. These are some ...
Q: Using DeMorgan's Law, write an expression for the complement of F if F(x,y,z) = xz' (xy + xz)+ xy'(w...
A: Demorgan’s law is a transformation rule in Boolean algebra. According to this rule,Negation of A OR ...
Q: In Python Define a function writeScores with two parameters. The first should be the name of a file,...
A: Below is the approach and python code:Approach:Define a function “writeScores” having two parameters...
Q: This program is written in pseudocode."Design a program that generates a 7-ddigit lottery number. Th...
A: This pseudocode explains how to create a 7-digit lottery number. These 7 digits are randomly generat...
Q: What are the different computer languages? Give a brief description of each.
A: DefinitionLanguage is the basic way of communication between the computer systems and to communicate...
Q: Odd man out: . Topological sort Algorithm DFS Algorithm Binary search Algorithm BFS Algorithm Prim's...
A: Answer:Binary Search AlgorithmExplanation:Topological sort Algorithm, DFS algorithm, BFS algorithm a...
Q: 4. Given the for loop, rewrite the code so that it executes exactly the same but uses a while loop f...
A: For-loop syntax: for(initialization ; condition ; updation) ...
Q: Using Java Eclipse create the following program
A: Below is the approach and java code to create an ArrayList which adds three objects Loan, Date, Circ...
Q: Hi, I am required to: Create an array of 100 integers using a random generator. ( 1 for loop) Provi...
A: create an array which able to store 100 integer numbers.Random class is used for generating 100 inte...