my_input = int(my_input)

There is no shorter way than using the int function (as you mention)

Answer from Gonzalo on Stack Overflow
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-convert-integers-to-strings-in-python-3
How To Convert Integers to Strings in Python 3 | DigitalOcean
September 3, 2020 - We can convert numbers to strings using the str() method. We’ll pass either a number or a variable into the parentheses of the method and then that numeric value will be converted into a string value.
🌐
Python Principles
pythonprinciples.com › blog › converting-integer-to-string-in-python
Converting integer to string in Python – Python Principles
To convert an integer to a string, use the str() built-in function. The function takes an int as input and produces a string as its output. Here are some examples.
🌐
Real Python
realpython.com › convert-python-string-to-int
How to Convert a Python String to int – Real Python
January 16, 2021 - There are several ways to represent integers in Python. In this quick and practical tutorial, you'll learn how you can store integers using int and str as well as how you can convert a Python string to an int and vice versa.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-string-to-int-int-to-string
Python String to Int, Int to String | DigitalOcean
August 4, 2022 - While converting from string to int you may get ValueError exception. This exception occurs if the string you want to convert does not represent any numbers. Suppose, you want to convert a hexadecimal number to an integer. But you did not pass argument base=16 in the int() function.
🌐
Career Karma
careerkarma.com › blog › python › python string to int() and int to string tutorial: type conversion in python
Python String to Int() and Int to String Tutorial: Type Conversion in Python
December 1, 2023 - The int() method can be used to convert a string to an integer value in Python. int() takes in two parameters: the string to convert into an integer and the base you want your data to be represented in.
🌐
Reddit
reddit.com › r/learnpython › cannot use str() to convert an int to a string.
r/learnpython on Reddit: Cannot use str() to convert an int to a string.
January 18, 2022 -

Okay, so I had a crash course in Python a looooong time ago, and that's all the prior experience I have with it. I'm starting to dabble in it again, playing around with it to make a text-based game.

In this game, you have stats - Speed, Health, etc etc. Each of these is a number (an int).

I am trying to define a function names statdisplay() so that when I call on it, it prints out your stats. So, if you have a Speed of 1, and the max Speed you can increase that stat to is 5, one of the printed lines would be:

Speed: 1 / 5

This was my ORIGINAL code:

 print("\nHealth: " + healthstat + " / " + maxhealth)
 print("\nHunger: " + hungerstat + " / " + maxhunger)

 print("\nStalking Skill: " + stalkingstat + " / 5")
 print("\nHunting Skill: " + huntingstat + " / 5")

 print("\nSpeed: " + speedstat + " / 5")
 print("\nStrength: " + speedstat + " / 5")

But then I got the following error:

TypeError: can only concatenate str (not "int") to str

So I mentally facepalmed myself and looked up how to convert an int to a string, and I keep reading that you can use the str() function (I know there are other ways, but I'm taking baby steps here trying to jog my memory on how everything works before I go doing everything by what's deemed "most appropriate").

This is my NEW code with that in mind:

 print("\nHealth: " + str(healthstat) + " / " + maxhealth)
 print("\nHunger: " + str(hungerstat) + " / " + maxhunger)

 print("\nStalking Skill: " + str(stalkingstat) + " / 5")
 print("\nHunting Skill: " + str(huntingstat) + " / 5")

 print("\nSpeed: " + str(speedstat) + " / 5")
 print("\nStrength: " + str(speedstat) + " / 5")

...and yet I am still getting the following error:

TypeError: can only concatenate str (not "int") to str

I can't seem to figure out what's wrong. I do not have the str() function defined as anything else. str() also doesn't seem to come from any special libraries that I'd need to import, but maybe I'm wrong there (I tried to look it up)... the only import I currently have is "import random".

My only other thought is that maybe it's a Google Colab thing, as that's where I'm currently running my code since this wasn't anything serious and I tend to go between two different computers.

Any help would be much appreciated!

Edit: accidentally had the new code in both code boxes.

🌐
Quora
quora.com › How-do-you-convert-int-to-string-without-using-an-in-built-function-in-Python-3-Python-Python-3-x-development
How to convert int to string without using an in-built function in Python 3 (Python, Python 3.x, development) - Quora
Answer (1 of 4): The simple answer is you cannot convert an int to a string without using any builtin functions. You can dress it up so the function isn’t visible but there are still functions being called.
Find elsewhere
🌐
Unstop
unstop.com › home › blog › convert int to string in python (6 methods with examples)
Convert Int To String In Python (6 Methods With Examples)
April 11, 2024 - One common approach to convert int to string in Python is to use built-in functions like str(), which directly converts an integer to its string representation. For instance, str(123) returns the string '123'.
🌐
W3Schools
w3schools.in › python › examples › convert-int-to-string
Python Program to Convert Int to String
Using % operator (also known as the "string formatting operator"). To convert an integer to a string in Python, the str() function can be used. This function takes an integer as an argument and returns the corresponding string representation of the integer.
🌐
FavTutor
favtutor.com › blogs › int-to-string-python
4 Ways to Convert Int to String in Python | FavTutor
September 14, 2021 - But apart from this, you can also use string formatting to convert an integer to a string. The “%s” keyword is used to convert int into a string. The empty string is created, and the “%s” operator is placed in it.
🌐
GeeksforGeeks
geeksforgeeks.org › python › convert-string-to-integer-in-python
Convert String to Int in Python - GeeksforGeeks
If the string contains non-numeric characters or is empty, int() will raise a ValueError. int() function automatically handles leading and trailing whitespaces, so int() function trims whitespaces and converts the core numeric part to an integer.
Published   September 11, 2025
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-convert-data-types-in-python-3
How To Convert Data Types in Python 3 | DigitalOcean
August 20, 2021 - We can convert numbers to strings through using the str() method. We’ll pass either a number or a variable into the parentheses of the method and then that numeric value will be converted into a string value.
🌐
GeeksforGeeks
geeksforgeeks.org › python › convert-integer-to-string-in-python
Convert integer to string in Python - GeeksforGeeks
This is similar to f-strings but works with older versions of Python (before 3.6). ... The %s keyword allows us to insert an integer (or any other data type) into a string.
Published   July 12, 2025
🌐
freeCodeCamp
freecodecamp.org › news › python-convert-string-to-int-how-to-cast-a-string-in-python
Python Convert String to Int – How to Cast a String in Python
November 29, 2021 - The error mentions that subtraction can't be performed between an int and a string. You can check the data type of the input by using the type() method: current_year = 2021 #ask user to input their year of birth user_birth_year_input = input("What year were you born?
🌐
W3Schools
w3schools.com › python › python_casting.asp
Python Casting
Python is an object-orientated language, and as such it uses classes to define data types, including its primitive types. Casting in python is therefore done using constructor functions: int() - constructs an integer number from an integer literal, a float literal (by removing all decimals), or a string literal (providing the string represents a whole number)
🌐
Replit
replit.com › home › discover › how to convert an int to a string in python
How to convert an int to a string in Python
F-strings, or formatted string ... a string. When you place an integer variable inside curly braces {} within a string prefixed with an f, Python automatically converts the integer to its string representation....