Write a gradebook program that lets a teacher keep track of test averages for his or her students. Your program shoudl 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 Here we go! **** 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 #1 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 #1 is 85.00 Average score for all students is: 80.83
Some hints:
This program should be named as follows: LastNameFirstName_assign5_part1.py (for example, "ShakespeareWilliam_assign5_part1.py")
Write a program that prompts the user to enter in a postiive number. Only accept positive numbers - if the user supplies a negative number or zero you should re-prompt them.
Next, determine if the given number is a prime number. A prime number is a number that has no positive divisors other than 1 and itself. For example, 5 is prime because the only numbers that evenly divide into 5 are 1 and 5. 6, however, is not prime because 1, 2, 3 and 6 are all divisors of 6.
Here's a sample running of the program:
Enter a positive number to test: 5 2 is NOT a divisor of 5 ... continuing 3 is NOT a divisor of 5 ... continuing 4 is NOT a divisor of 5 ... continuing 5 is a prime number!
And here's another running:
Enter a positive number to test: 9 2 is NOT a divisor of 9 ... continuing 3 is a divisor of 9 ... stopping 9 is not a prime number.
Some notes on your program:
This program should be named as follows: LastNameFirstName_assign5_part2a.py (for example, "ShakespeareWilliam_assign5_part2a.py")
Next, make a copy of Part A and update it so that the program now finds all prime numbers between 1 and 1000. Here's a sample running of your program:
1 is a prime number! 2 is a prime number! 3 is a prime number! 5 is a prime number! 7 is a prime number! 11 is a prime number! ... cut ... 977 is a prime number! 983 is a prime number! 991 is a prime number! 997 is a prime number!
This program should be named as follows: LastNameFirstName_assign5_part2b.py (for example, "ShakespeareWilliam_assign5_part2b.py")