Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writing a Program in Python Newest Version of Python please Print(' ...') must be used PYTHON Write a gradebook program that lets a teacher keep

Writing a Program in Python

Newest Version of Python please

Print(' ...') must be used

PYTHON

Write a gradebook program that lets a teacher keep track of test averages for his or her students. Your program should begin by asking the teacher for a number of students in their class as well as the total # of tests that will be given to the class. Validate this information to ensure that the numbers entered are positive.

Next, prompt the teacher to enter in scores for each student. Ensure that the values entered are positive - if they aren't you will need to re-prompt them. Hint: you may need to use nested loops here! A "while" loop can be placed inside of a "for" loop, if necessary.

Once your program has collected all test scores for a student it should display that student's average and move onto the next student. When all students have been calculated the program should compute the overall average score for the entire class.

Here's a sample running of your program:

How many students are in your class? -5 Invalid # of students. Try again. How many students are in your class? 3 How many tests in this class? -10 Invalid # of tests. Try again. How many tests in this class? 2 **** Student 1 **** Enter score for test #1: -50 Invalid score. Try again. Enter score for test #1: 50 Enter score for test #2: 75 Average score for student #1 is 62.50 **** Student 2 **** Enter score for test #1: 100 Enter score for test #2: 90 Average score for student #2 is 95.00 **** Student 3 **** Enter score for test #1: -10 Invalid score. Try again. Enter score for test #1: -20 Invalid score. Try again. Enter score for test #1: -30 Invalid score. Try again. Enter score for test #1: 90 Enter score for test #2: 80 Average score for student #3 is 85.00 Average score for all students is 80.83 

Some hints:

Begin by constructing a "for" loop to iterate over all students in the class

Once you're inside of this "for" loop you will probably need another loop to handle inputting the scores for a particular student.

Big hint: Try to get your program to work first without any data validation. You can add this in later once you figure out the general structure of the program.

Remember the difference between "for" and "while" loops! "for" loops are used when you want to iterate over a know # of items, and "while" loops can be used to keep the user "caught" indefinitely until they fulfill a particular condition. You will probably need to use a combination of these loops to solve this problem.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago