How to fix TypeError: can only concatenate str (not "int") to str in Python

1 Answer

0 votes
s = "python"
n = 4

# TypeError: can only concatenate str (not "int") to str
# result = s + n

result = s + str(n)

print(result)




'''
run:

python4

'''

 



answered Jan 31, 2022 by avibootz
...