TypeError: Can only concatenate str (not “int”) to str (simple Python programme)

后端 未结 11 648
逝去的感伤
逝去的感伤 2020-12-07 05:17

I wrote this simple code and tried to execute in Windows 10 CMD ... and it gets the error message :

TypeError: Can only concatenate str (not \"int\") to str
         


        
11条回答
  •  北海茫月
    2020-12-07 06:05

    You add a string to an int, because the input() function returns a string. Use int(input('age: ')).

提交回复
热议问题