Problem
Use while to create an infinite loop.
Enter your score and ask them to enter your test score (integer value).
The average score is calculated by the total number of points/number of people, so we will add the entered score to the total value.
When -1 is entered, repeat the process there.
Lastly, please indicate "The average score on the test for ○○ people is △△."
My own code
n=1
while True:
score=int(input("Please enter a score""))
n + = 1
scores=
ave=score/n
if score==-1:
break
print(ave)
It's not going well.
I would appreciate it if you could point it out.
This seems to be an assignment (homework?), so please review the following regarding your thinking.
By the way, if you compare the question sentence with the source code, you can't do well in the "average score/number of people" part when you try to convert the contents of the question sentence into a program in the order written in the question sentence.
Since you feel that it has not yet been completed and has not yet reached the point of operation, have you not presented any errors?
The problem statement does not work that way because it bulletifies what the program should do and does not even show detailed execution procedures (so to speak, flowcharts).
For classes/lectures/exercises, you should have presented in advance what to think about and how to work on the program based on the questions/challenges described in these sentences, so please review them and follow them.If you're self-taught, look for reference books and materials about these things and study them.
For example, you'll need to think about this
© 2024 OneMinuteCode. All rights reserved.