Recently, I was working on a financial application in Python where I wanted to concatenate string and float. I tried three methods. In this tutorial, I will show you how to concatenate string and float in Python using various methods with examples.
To concatenate a string and a float in Python, you can use the str() function to convert the float to a string. For example, if you have city = "New York" and temperature = 75.5, you can concatenate them using result = city + " has a temperature of " + str(temperature) + " degrees Fahrenheit.".
Concatenate String and Float in Python
In Python, you can use various methods to concatenate a string and a float. Let me show you each method with examples.
Method 1: Using the str() Function
The best way to concatenate a string and a float in Python is by converting the float to a string using the str() function. This method ensures that both operands are of the same type (string). Here is an example to understand it better.
Example:
city = "New York"
temperature = 75.5
result = city + " has a temperature of " + str(temperature) + " degrees Fahrenheit."
print(result)Output:
New York has a temperature of 75.5 degrees Fahrenheit.You can also see the exact output in the screenshot below after I executed the above Python code using an Online Python editor.

Read How to use Pandas to convert float to int in Python
Method 2: Using String Formatting
Python offers several ways to format strings like the format() method and f-strings. We can use these methods to concatenate a string with a float in Python.
Using format() Method:
The format() method allows you to insert variables into a string template. Here is an example.
Example:
city = "Los Angeles"
temperature = 80.3
result = "{} has a temperature of {} degrees Fahrenheit.".format(city, temperature)
print(result)Output:
Los Angeles has a temperature of 80.3 degrees Fahrenheit.I executed the above Python code, and you can see the output in the screenshot below:

Using f-Strings:
Introduced in Python 3.6, f-strings provide a more concise and readable way to format strings. Here is an example.
Example:
city = "Chicago"
temperature = 70.2
result = f"{city} has a temperature of {temperature} degrees Fahrenheit."
print(result)Output:
Chicago has a temperature of 70.2 degrees Fahrenheit.Read How to convert float to int Python
Method 3: Using the join() Method
The join() method can also be used to concatenate strings and floats in Python. However, you must first convert the float to a string. Let me show you an example to help you understand.
Example:
city = "Houston"
temperature = 85.7
result = " ".join([city, "has a temperature of", str(temperature), "degrees Fahrenheit."])
print(result)Output:
Houston has a temperature of 85.7 degrees Fahrenheit.After I executed the above Python code, you can see the output in the screenshot below:

Method 4: Using print() with Multiple Arguments
While this doesn’t directly concatenate strings and floats into a single string, using print() with multiple arguments can be useful for quick output formatting.
Here is an example.
Example:
city = "San Francisco"
temperature = 65.1
print(city, "has a temperature of", temperature, "degrees Fahrenheit.")Output:
San Francisco has a temperature of 65.1 degrees Fahrenheit.Conclusion
In this tutorial, I have explained how to concatenate a string and a float in Python using different methods like the str() function, string formatting, or using f-strings, etc.
I recommend using the str() functions for concatenating strings and floats in Python.
You may like the following tutorials:
- How to convert string with comma to float in Python?
- How to create a list of floats in Python
- How to Check if a Float Variable is Empty in Python?
- end in Python

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.