When I'm done, it'll ask the user to input the number of tests/quizzes/hw problems for the year and then ask them for how much of the final grade they are worth. Then, it'll ask the user to input each grade.
But I've hit a snag.
I'm using a while loop so the program stops when the number of grades entered equals the number the user input for how many grades there were.
Basically, something like this:
- Code: Select all
test = int(input("Total number of tests for the year? "))
testTotal = 0
count = 0
while count < test:
user = int(input("Enter grade: "))
count += 1
testTotal += user
testAverage = testTotal / test
print(testAverage)
I've got some other stuff in there to (validation loops, etc). This is just the most basic version of the code.
The problem is, the output looks like this:
- Code: Select all
Total number of tests for the year?
Enter grade:
Enter grade:
Enter grade:
(repeat until all grades have been entered)
I want it to print:
Enter grade 1:
Enter grade 2:
Enter grade 3:
etc.
How do I do this?
EDIT:
I would also like to be able to ask the user a Y/N question.
I want it to ask the user if they want to see their average for each individual section (test, quiz, homework, etc) and, if they input "Y", have it print those to the screen.
How would I implement Y/N prompts in Python?

