I am using a tutorial to get used to python by makeing simple games.
In the tutorial it tells me to
Now myName is a str object but guessesTaken is an int.Code:28. if guess == number: 29. guessesTaken = str(guessesTaken) 30. print('Good job, ' + myName + '! You guessed my number in ' + guessesTaken + ' guesses!')
When I run the code in the tutorial (above) I get an error
line 31, in <module>
print('Good job, ' + PlayerName + '! You guessed my number in ' + guessesTaken + ' guesses!')
TypeError: cannot concatenate 'str' and 'int' objects
my name for things is slightly different than the tutorial but neither work.
How to I get it to display int objects?



LinkBack URL
About LinkBacks
Reply With Quote

