TypeError: unsupported operand type(s) for +: 'int' and 'str' error

后端 未结 3 1594
灰色年华
灰色年华 2020-12-04 03:10

Im having a problem with my code and it says

TypeError: unsupported operand type(s) for +: \'int\' and \'str\'

and i\'m not sur

3条回答
  •  渐次进展
    2020-12-04 04:17

    You explicitely take care that the things the user inputs are strings:

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

    if you replace str() by int() or float() (depending on what you expect the input to be), your problem should go away, because you'd get a numeric type rather than a string.

提交回复
热议问题