MY程序每次输出的成绩是竞争对手的7分,而不是竞争对手的分数 有人可以帮我解决这个问题吗(程序尚未完全完成,我知道程序中还有其他错误的问题,请问您只能解决“ j not looping issue”问题,而不能解决其他问题)
numJudges = 7
numCompetitors = int(input("Enter number of competitors(between 3 and 16 inc)" ))
for comp in range(0,numCompetitors):
totalC = 0
print("input scores between 0 and 10 for each Judge")
for j in range(0, numJudges):
j = j+1
scoreJ = int(input("Score for judge"))
totalC = totalC + scoreJ
scoreC = totalC / numJudges
print("Score for competitor ", j ," is", scoreC)
j
isn't the number of your competitor - it's the ID of the last judge.You need to be outputting
comp
in the last line instead.