Question

Asked Nov 9, 2019

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.

**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

grade_level = []test_score = []

# menu

while True:

print("\nPlease choose from the following menu:")

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.")

continue print("\nPlease choose the grade level from the following menu:")

print("\t1) Freshman")

print("\t2) Sophomore")

print("\t3) Junior")

print("\t4) Senior")

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

grade = int(gra)

grade_level.append(grade)

# 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("\nTotal number of students entered:\t",len(grade_level))

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

&...

Tagged in

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...