TypeError: Can’t convert ‘int’ object to str implicitly

You cannot concatenate a string with an int. You would need to convert your int to a string using the str function, or use formatting to format your output.

Change: –

print("Ok. Your balance is now at " + balanceAfterStrength + " skill points.")

to: –

print("Ok. Your balance is now at {} skill points.".format(balanceAfterStrength))

or: –

print("Ok. Your balance is now at " + str(balanceAfterStrength) + " skill points.")

or as per the comment, use , to pass different strings to your print function, rather than concatenating using +: –

print("Ok. Your balance is now at ", balanceAfterStrength, " skill points.")

Leave a Comment