In Python 3.6 f-strings are introduced.

You can write like this

print (f"So, you're {age} old, {height} tall and {weight} heavy.")

For more information Refer: https://docs.python.org/3/whatsnew/3.6.html

Answer from Nithin R on Stack Overflow
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ tutorial โ€บ inputoutput.html
7. Input and output โ€” Python 3.15.0 documentation
So far weโ€™ve encountered two ways of writing values: expression statements and the print() function. (A third way is using the write() method of file objects; the standard output file can be referenced as sys.stdout. See the Library Reference for more information on this.) Often youโ€™ll want more control over the formatting of your output than simply printing space-separated values.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-output-formatting
Python - Output Formatting - GeeksforGeeks
The string modulo operator (%) is one of the oldest ways to format strings in Python. It allows you to embed values within a string by placing format specifiers in the string. Each specifier starts with a % and ends with a character that represents the type of value being formatted. ... # string modulo operator(%) print("Geeks : -, Portal : %5.2f" % (1, 05.333)) print("Total students : =, Boys : -" % (240, 120)) # print integer value print("%7.3o" % (25)) # print octal value print(".3E" % (356.08977)) # print exponential value
Published: December 16, 2024
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ python-formatting-python-print-statements-91
Python Basics | Print() Function | Format Specifiers | f-Strings | LabEx
Open up a new Python interpreter session and type the following code: ... This will output the string "Hello, World!" to the console. You can also pass multiple arguments to the print() function, and it will print them separated by a space by default. For example: ... This will output the string "Hello, World!" to the console. You can use format specifiers to control how values are printed.
๐ŸŒ
Learn Python
learnpython.org โ€บ en โ€บ String_Formatting
String Formatting - Learn Python - Free Interactive Python Tutorial
# This prints out "John is 23 years old." name = "John" age = 23 print("%s is %d years old." % (name, age)) Any object which is not a string can be formatted using the %s operator as well. The string which returns from the "repr" method of that object is formatted as the string.
๐ŸŒ
Python Course
python-course.eu โ€บ python-tutorial โ€บ formatted-output.php
22. Formatted Output | Python Tutorial | python-course.eu
Even though it may look so, the formatting is not part of the print function. If you have a closer look at our examples, you will see that we passed a formatted string to the print function. Or to put it in other words: If the string modulo operator is applied to a string, it returns a string.
๐ŸŒ
Wiingy
wiingy.com โ€บ home โ€บ learn โ€บ python โ€บ output formatting in python
Output Formatting in Python
January 30, 2025 - This can include manipulating the size, shape, color, and other properties of text and visual elements to make the data more visually appealing and easier to understand. Python provides various tools and libraries for output formatting, including built-in functions like print() and more advanced options like string formatting and regular expressions.
๐ŸŒ
w3resource
w3resource.com โ€บ python โ€บ python-print-statement.php
Python print() function
The simplest way to use the print() function is by passing a string or variable as an argument: ... print("Python", "is", "fun", sep="-") # Output: Python-is-fun print("Hello", end=", ") print("world!") # Output: Hello, world!
Find elsewhere
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ built-in โ€บ format
Python format()
# formatting numbers without specifying width no_width = format(123, 'd') print("Without specified width:", no_width)
๐ŸŒ
Fangohr
fangohr.github.io โ€บ introduction-to-python-for-computational-science-and-engineering โ€บ 05-input-output.html
5. Input and Output โ€” Introduction to Python for Computational Science and Engineering
All other functions in Python are called such that the argument is enclosed in parentheses, i.e. ... Everything we have learned about formatting strings using the percentage operator still works the same way: import math a = math.pi "my pi = %f" % a # string formatting ... Short pi = 3.14, longer pi = 3.141592653590. print("Short pi = %.2f, longer pi = %.12f."
๐ŸŒ
Real Python
realpython.com โ€บ python-print
Your Guide to the Python print() Function โ€“ Real Python
July 3, 2026 - By using a semicolon (;), you can place multiple Python statements on a single line. Although this enhances readability in this particular example, itโ€™s usually better to follow standard formatting practices for clarity. You can implement the individual functions that appear in the example above in merely ten lines of code: ... from time import sleep speed = 0.1 def signal(duration, symbol): sleep(duration) print(symbol, end="", flush=True) dot = lambda: signal(speed, "ยท\a") dash = lambda: signal(3*speed, "โˆ’\a") symbol_space = lambda: signal(speed, "") letter_space = lambda: signal(3*speed, "") word_space = lambda: signal(7*speed, " ") # ...
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ print-function
Explore Python's print() function, master output customization
The pprint (pretty-print) module in Python provides a way to format complex data structures in a readable way.
๐ŸŒ
Medium
medium.com โ€บ @raidivya โ€บ python-print-function-0bcc7e44df45
Python: print() Function. The print() function outputs text andโ€ฆ | by Divya Rai | Medium
June 23, 2024 - Clear and Concise Messages: Ensure your print statements are clear and convey the intended message. Use f-strings for Formatting: f-strings are a concise and readable way to format strings.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_string_formatting.asp
Python String Formatting
The function does not have to be a built-in Python method, you can create your own functions and use them: ... def myconverter(x): return x * 0.3048 txt = f"The plane is flying at a {myconverter(30000)} meter altitude" print(txt) Try it Yourself ยป ยท At the beginning of this chapter we explained how to use the .2f modifier to format a number into a fixed point number with 2 decimals.
๐ŸŒ
IncludeHelp
includehelp.com โ€บ python โ€บ print-function.aspx
Python print() function: Format, Code, Arguments, Examples
Learn the Python print() function with examples on how to display output, format strings, and use it effectively for debugging and displaying results.
๐ŸŒ
Stanford CS
cs.stanford.edu โ€บ people โ€บ nick โ€บ py โ€บ python-print.html
print() and Standard Out
The Python print() function takes in any number of parameters, and prints them out on one line of text. The items are each converted to text form, separated by spaces, and there is a single '\n' at the end (the "newline" char). When called with zero parameters, print() just prints the '\n' ...
๐ŸŒ
Real Python
realpython.com โ€บ python-formatted-output
A Guide to Modern Python String Formatting Tools โ€“ Real Python
February 1, 2025 - The requirement that all positional arguments appear before any keyword arguments doesnโ€™t only apply to the .format() method. This is generally true for any function or method call in Python.
๐ŸŒ
Edureka
edureka.co โ€บ blog โ€บ format-function-in-python
Format Function in Python | Python fomrat() Function Examples | Edureka
November 27, 2024 - Palindrome in Python: How to Check a Number or String is Palindrome? ... Format Function in Python (str.format()) is technique of the string category permits you to try and do variable substitutions and data formatting. It enables you to concatenate parts of a string at desired intervals through point data format.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_output_formatting.htm
Python - Output Formatting
We can format output using the string modulo operator %. This operator is unique to strings and makes up for the pack of having functions from C's printf() family. Format specification symbols like %d, %c, %f, and %s are used as placeholders ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-output-using-print-function
Python - Print Output using print() function - GeeksforGeeks
In this code, we are passing two parameters name and age to the print function. ... Hello, my name is Alice and I am 25 years old. String literals in Python's print statement are primarily used to format or design how a specific string appears when printed using the print() function.
Published: July 11, 2025