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
People also ask

What is the easiest way to print text and a variable together?
Use print("Text:", variable) for simple output, or print(f"Text: {variable}") with an f-string for formatted text in modern Python.
🌐
golinuxcloud.com
golinuxcloud.com › home › programming › python › print variable in python
Print Variable in Python: print(), f-strings, sep, format(), and ...
Can you print a string and an integer with + in Python?
Not directly. "Age: " + age raises TypeError when age is an int. Use print("Age:", age), an f-string, or convert the number with str(age) before using +.
🌐
golinuxcloud.com
golinuxcloud.com › home › programming › python › print variable in python
Print Variable in Python: print(), f-strings, sep, format(), and ...
How do you print without a newline in Python?
Use print(value, end="") to keep the next print() on the same line. By default, print() adds a newline at the end.
🌐
golinuxcloud.com
golinuxcloud.com › home › programming › python › print variable in python
Print Variable in Python: print(), f-strings, sep, format(), and ...
🌐
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.
🌐
Replit
replit.com › home › discover › how to print a variable in python
How to print a variable in Python | Replit
April 14, 2026 - This example shows how to create a simple log file. The code first opens app_log.txt in write mode ('w'), which creates the file if it doesn't exist. Inside the with block, each print() statement writes a line of text directly to the file object, including a timestamp from the time module.
🌐
Python Guides
pythonguides.com › print-a-string-and-variable-in-python
How to Print Variables in Python
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.
Find elsewhere
🌐
GoLinuxCloud
golinuxcloud.com › home › programming › python › print variable in python
Print Variable in Python: print(), f-strings, sep, format(), and Examples
June 23, 2026 - Use print("Text:", variable) for simple text plus a variable. Use f-strings for clean formatted output. Use sep and end to control spacing and newlines. Use pprint() for nested data.
🌐
W3Schools
w3schools.com › python › python_variables_output.asp
Python - Output Variables
x = "Python is awesome" print(x) Try it Yourself » · In the print() function, you output multiple variables, separated by a comma:
🌐
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.
🌐
w3resource
w3resource.com › python › python-print-statement.php
Python print() function
name = "Tom" age = 25 print("Hello, %s. You are %d years old." % (name, age)) ... Hello, Tom. You are 25 years old. ... Strings can be assigned to variable say string1 and string2 which can called when using the print statement.
🌐
JanBask Training
janbasktraining.com › community › python › print variable and a string in python
Print variable and a string in python | JanBask Training Community
August 26, 2025 - While Python supports multiple methods, f-strings are the most modern, readable, and efficient way to print variables with strings.
🌐
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.
🌐
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 can do this by adding a string of text inside our print() function. ... If you run this code, you should see Hello, my name is John Doe printed on your screen. String formatting is a way to inject variables into a string in a more readable ...
🌐
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?

🌐
YouTube
youtube.com › watch
[Beginner] Print Statements and Variables in Python - YouTube
This video shows how to print multiple strings of text, how to print variables, and how to change the Separating Character (sep). The video does not show cha...
Published: August 27, 2022
🌐
Delft Stack
delftstack.com › home › howto › python › python print variable
How to Print Variable in Python | Delft Stack
February 2, 2024 - In Python 2, the syntax for the print statement is pretty simple. All we have to do is use the print keyword. ... In Python 3, to run the print statement without any errors, there needs to be a parenthesis followed by the print keyword.
🌐
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 - Readable Code: Use f-strings (e.g., f"text {variable}") for a clean, intuitive way to embed variables directly into strings, making your code easier to write and understand. Prevents Type Errors: Learning modern formatting methods helps you ...
🌐
Analytics4All
analytics4all.org › 2016 › 04 › 27 › python-print-variables-and-user-input
Python: Print Variables and User Input – Analytics4All
July 25, 2022 - Printing variables by themselves ... If the variable you want to print is a number, use the special string %d inside the quotes and % variable outside the quotes....