By printing multiple values separated by a comma:

print "I have", card.price

The print statement will output each expression separated by spaces, followed by a newline.

If you need more complex formatting, use the ''.format() method:

print "I have: {0.price}".format(card)

or by using the older and semi-deprecated % string formatting operator.

Answer from Martijn Pieters on Stack Overflow
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-print-variable-how-to-print-a-string-and-variable
Python Print Variable โ€“ How to Print a String and Variable
December 7, 2021 - In the following example, I want to print the value of a variable along with some other text. I add the strings in double quotes and the variable name without any surrounding it, using the addition operator to chain them all together: fave_language = "Python" print("I like coding in " + fave_language + " the most") #output #I like coding in Python the most
Discussions

How to print a variable and a string at once in Python 3
print("The year of birth for", person) or print(f"The year of birth for {person}") The second one is called a formatted string, and can be very useful. More on reddit.com
๐ŸŒ r/learnprogramming
13
5
July 23, 2021
How can I print variable and string on same line in Python? - Stack Overflow
Starting from Python-3.8, you can use f-strings with variable name printing! More on stackoverflow.com
๐ŸŒ stackoverflow.com
why is print a legal variable name?
First off, to hell with trick questions like that on any test. It has almost no value at all and is more of a trivia question than anything else. To answer the question though: because it's a function not a reserved word. Here are the "reserved words" in python, notice none of them are functions. import keyword print( keyword.kwlist ) ['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield'] In python functions are objects, so you can assign new references to them, print is by default the reference to the print function. But you could for instance make a new reference: p = print or you could make a new version of print def print(*p, **kw): pass if you for instance wanted to run your program in "silent mode". Or combine the above to temporarily wrap a noisy/verbose call. def noprint(*p, **kw): pass save_print = print print = noprint # run noisy function call with too many print statements print = save_print More on reddit.com
๐ŸŒ r/learnpython
72
116
September 9, 2021
When I want to print the value of a variable, is there any good way to also print its identifier?
Yes - print(f'{x=}') More on reddit.com
๐ŸŒ r/learnpython
8
3
April 23, 2022
People also ask

How to print multiple variables in Python?
To print multiple variables in Python, you can pass them to the print() function separated by commas, which automatically adds spaces between them. For example, x = 10; y = 20; print("Values:", x, y) outputs "Values: 10 20". Alternatively, use f-strings like print(f"Values: {x} {y}") for more control over formatting.
๐ŸŒ
purpletutor.com
purpletutor.com โ€บ home โ€บ understanding code โ€บ python print with variable methods for clear output
Python print with variable ๐Ÿ’ป avoid TypeError and debug output
What are the different methods to print variables in Python?
The main methods to print variables in Python include using the print() function with commas, string concatenation with the + operator, string formatting with .format(), and f-strings for modern Python versions. Commas automatically add spaces between items, while concatenation requires type conversion for non-strings. F-strings provide a concise and readable way to embed variables directly into strings.
๐ŸŒ
purpletutor.com
purpletutor.com โ€บ home โ€บ understanding code โ€บ python print with variable methods for clear output
Python print with variable ๐Ÿ’ป avoid TypeError and debug output
How to print a variable and a string in Python using concatenation?
To print a variable and a string using concatenation in Python, use the + operator to join them, ensuring the variable is converted to a string if necessary with str(). For instance, age = 25; print("I am " + str(age) + " years old.") will output "I am 25 years old." This method works in all Python versions but can be cumbersome for multiple variables.
๐ŸŒ
purpletutor.com
purpletutor.com โ€บ home โ€บ understanding code โ€บ python print with variable methods for clear output
Python print with variable ๐Ÿ’ป avoid TypeError and debug output
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_variables_output.asp
Python - Output Variables
In the print() function, you output multiple variables, separated by a comma: x = "Python" y = "is" z = "awesome" print(x, y, z) Try it Yourself ยป ยท You can also use the + operator to output multiple variables: x = "Python " y = "is " z = "awesome" print(x + y + z) Try it Yourself ยป ยท Notice the space character after "Python " and "is ", without them the result would be "Pythonisawesome".
๐ŸŒ
Replit
replit.com โ€บ home โ€บ discover โ€บ how to print a variable in python
How to print a variable in Python | Replit
April 14, 2026 - Even with a simple function like print(), you can run into a few common pitfalls that are easy to solve once you know how. A frequent hurdle is the TypeError that appears when you try to join a string and a number with the + operator. This happens because Python can't guess whether you want to add numbers or combine strings.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnprogramming โ€บ how to print a variable and a string at once in python 3
r/learnprogramming on Reddit: How to print a variable and a string at once in Python 3
July 23, 2021 -

In the title how do I print both a static string and a varaible at once, I tried doing it like this:

print ("The year of birth for ") (person)

But it gave me a notype error. But that makes no sense to me as this program has no functions and the variable was defined and worked fine earlier in the program. Can someone help?

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ g-fact-25-print-single-multiple-variable-python
Print Single and Multiple variable in Python - GeeksforGeeks
July 23, 2025 - In Python, printing single and multiple variables refers to displaying the values stored in one or more variables using the print() function.
Find elsewhere
๐ŸŒ
Python Guides
pythonguides.com โ€บ print-a-string-and-variable-in-python
Python Print Variable: Print a String and Variable Together
October 14, 2025 - Print a variable in Python with print(), commas and f-strings. Join text and numbers, format dollars, show a variable's name and value, and fix errors.
๐ŸŒ
Purple Engineer
purpletutor.com โ€บ home โ€บ understanding code โ€บ python print with variable methods for clear output
Python print with variable ๐Ÿ’ป avoid TypeError and debug output
January 4, 2026 - Variables have three essential characteristics that matter when printing: their name (how you reference them), their value (what they contain), and their data type (the nature of the stored information). The name serves as your identifier in code, the value represents the actual data, and the data type determines how Python interprets and displays that information. # Variable examples with different data types name = "Alice" # String age = 28 # Integer height = 5.6 # Float is_student = True # Boolean
๐ŸŒ
GoLinuxCloud
golinuxcloud.com โ€บ home โ€บ programming โ€บ python โ€บ print variable in python
Print Variable in Python: print(), f-strings, sep, format(), and Examples
June 23, 2026 - The print() function displays variable values in the console. The simplest form is print(variable). When you need text with variables, f-strings are usually the cleanest option in modern Python.
๐ŸŒ
Jeremy Morgan
jeremymorgan.com โ€บ python โ€บ how-to-print-a-string-and-a-variable-in-python
How to Print a String and a Variable in Python
To print a string and a variable in Python, you can use the print() function. The print() function takes one or more arguments, which are separated by commas. The first argument is the string to be printed, followed by any number of variables.
๐ŸŒ
w3resource
w3resource.com โ€บ python โ€บ python-print-statement.php
Python print() function
This tutorial explains various ways to use print() for different formatting needs, string manipulation, and data types. The simplest way to use the print() function is by passing a string or variable as an argument:
๐ŸŒ
Utrechtuniversity
utrechtuniversity.github.io โ€บ workshop-introduction-to-python โ€บ Introduction_to_python_1.html
2 Variables and printing output โ€“ Introduction to Python & Data
If the last operation is the assignment of a variable, nothing will be printed. In general print is the only way to print output to the screen when you are not working in an interactive environment like Jupyter (as we are doing now). Rule of thumb: use the normal output for quick checking the output of an operation while developing in your Jupyter notebook, use print for printing output that still needs to be there in the future while your scripts get more complicated. Continue with the following chapter Operators and Built-in Functions
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ print-function
Explore Python's print() function, master output customization
Master Python from basics to advanced topics, including data structures, functions, classes, and error handling ... Start your coding journey with Python. Learn basics, data types, control flow, and more ... # 1. Print a simple text string print("Hello, World!") # Outputs: Hello, World! # 2. Print the value of a variable name = "Alice" print(name) # Outputs: Alice # 3.
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ python โ€บ python print variable
How to Print Variable in Python | Delft Stack
February 2, 2024 - This method allows us to create a formatted string with a more structured approach. In Python, you can use string formatting with the help of curly braces {} to embed variables within a string when using the print statement.
๐ŸŒ
Altcademy
altcademy.com โ€บ blog โ€บ how-to-print-a-variable-in-python
How to print a variable in Python - Altcademy.com
September 12, 2023 - You can then put information into the drawer, take information out, or change the information. It's just like storing items in a real-life drawer. In Python, printing a variable is as simple as using the print() function.
๐ŸŒ
Altcademy
altcademy.com โ€บ blog โ€บ how-to-print-variables-in-python
How to print variables in Python - Altcademy.com
September 4, 2023 - We simply write all the variables we want to print inside the print() function, separated by commas. ... If you run this code, you should see John Doe printed on your screen. Sometimes, we want to print some text along with our variable.
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 2515650 โ€บ python-how-can-i-print-a-variable-and-a-text
Python. How can I print a variable and a text?
Sololearn is the world's largest community of people learning to code. With over 25 programming courses, choose from thousands of topics to learn how to code, brush up your programming knowledge, upskill your technical ability, or stay informed about the latest trends.
๐ŸŒ
Real Python
realpython.com โ€บ python-print
Your Guide to the Python print() Function โ€“ Real Python
July 3, 2026 - As with any function, it doesnโ€™t matter whether you pass a literal, a variable, or an expression. Unlike many other functions, however, print() will accept anything regardless of its type.