TypeError: tipo (s) de operando no admitidos para +: error ‘int’ y ‘str’

Estoy teniendo un problema con mi código y dice

TypeError: tipo (s) de operando no soportado para +: ‘int’ y ‘str’

y no estoy seguro de por qué. el área de mi código que causa esto se muestra a continuación, se agradecería toda la ayuda: D! * Editar el error parece ocurrir debido a las opciones de entrada, si eso ayuda de alguna manera.

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))) 

Usted cuida explícitamente que las cosas que el usuario ingresa son cadenas:

 Score1 = str(input("what did the first person get in their test the first time?")) 

Si reemplaza str() por int() o float() (dependiendo de lo que espera que sea la entrada), su problema debería desaparecer, ya que obtendría un tipo numérico en lugar de una str .

Convierta la cadena de forma predeterminada a un entero para que pueda calcular las puntuaciones promedio:

 Score1 = int(input("what did the first person get in their test the first time?")) 

También puede utilizar el mapa mientras calcula su puntuación.

 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(map(int,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(map(int,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(map(int,P3S))/float(len(P3S))) 

También puede indicar cómo está proporcionando las entradas.