Python - Convert Int to String

Converting an int to a string in Python can be done using the built-in str() method. Typically, you need to do this when concatenating an int and a string.

score = 72
result = 'Your score is: ' + str(score)

print(result)
# Your score is: 72

From Python 3.6 onwards you can also use f-strings which do not require you to convert an integer to a string.

score = 72
result = f'Your score is: { score }'

print(result)
# Your score is: 72