我的代码有问题,它说
TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’
而且我不确定为什么.我的代码区域导致了这一点,如下所示,所有帮助将不胜感激:D!*编辑错误似乎是因为输入选项,如果这有任何帮助.
Score1 = str(input("what did the first person get in their test the first time?"))
Score2 = str(input("what did the first person get in their test the second time?"))
Score3 = str(input("what did the first person get in their test the third time?"))
Score4 = str(input("what did the second person get in their test the first time?"))
Score5 = str(input("what did the second person get in their test the second time?"))
Score6 = str(input("what did the second person get in their test the third time?"))
Score7 = str(input("what did the third person get in their test the first time?"))
Score8 = str(input("what did the third person get in their test the second time?"))
Score9 = str(input("what did the third person get in their test the third time?"))
P1S = [Score1, Score2, Score3]
P2S = [Score4, Score5, Score6]
P3S = [Score7, Score8, Score9]
print ("here are the scores of",Name1,",well done") # defines scores
print(P1S)
print ("here is the average score of",Name1,",Well Done") # makes average of scores
print(sum(P1S)/float(len(P1S)))
print ("here are the scores of",Name2,",well done") # defines scores
print(P2S)
print ("here is the average score of",Name2,",Well Done") # makes average of scores
print(sum(P2S)/float(len(P2S)))
print ("here are the scores of",Name3,",well done") # defines scores
print(P3S)
print ("here is the average score of",Name3,",Well Done") # makes average of scores
print(sum(P3S)/float(len(P3S)))