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
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_strings.asp
Python Strings
Strings in python are surrounded by either single quotation marks, or double quotation marks. ... print("It's alright") print("He is called 'Johnny'") print('He is called "Johnny"') Try it Yourself ยป
Discussions

Printing string and integer (or float) in the same line
If a define a variable x=8 and need an output like "The number is 8" (in the same line), how could I print the string "The number is" and the variable "x" together? Or the second after the first but in the same line? ... If you're using Python 3.6 you can make use of f strings. More on sololearn.com
๐ŸŒ sololearn.com
8
4
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
๐ŸŒ
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 - To print anything in Python, you use the print() function โ€“ that is the print keyword followed by a set of opening and closing parentheses,(). #how to print a string print("Hello world") #how to print an integer print(7) #how to print a variable ...
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ print-function
Explore Python's print() function, master output customization
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. Print multiple items at once age = 30 print("Name:", name, "Age:", age) # Outputs: Name: Alice Age: 30 # 4.
๐ŸŒ
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.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ tutorial โ€บ inputoutput.html
7. Input and output โ€” Python 3.15.0 documentation
Formatted string literals (also called f-strings for short) let you include the value of Python expressions inside a string by prefixing the string with f or F and writing expressions as {expression}. An optional format specifier can follow the expression. This allows greater control over how the value is formatted. The following example rounds pi to three places after the decimal: >>> import math >>> print(f'The value of pi is approximately {math.pi:.3f}.') The value of pi is approximately 3.142.
๐ŸŒ
LabEx
labex.io โ€บ questions โ€บ how-to-print-a-python-string-271597
How to Print Strings in Python | LabEx
July 25, 2024 - The simplest way to print a string in Python is to use the print() function and pass the string as an argument.
Find elsewhere
๐ŸŒ
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-print-string-and-int-in-the-same-line-in-python
How to Print String and Int in the Same Line in Python - GeeksforGeeks
July 23, 2025 - In this code, we use the map() function to convert all elements in the data list to strings, and then we use the join() method to combine them with a space delimiter. ... name = "John" age = 30 print("My name is", name, "and I am", age, "years old.")
๐ŸŒ
Umn
docs.cems.umn.edu โ€บ intro โ€บ Prt_01_Lssn_04_Using_Strings_and_Print().html
5. Using Strings and print() โ€” Intro to Scientific Python
Here, we see that the 25th indexed position is called for the first position, but nothing is included after the : symbol. The Python shell interprets this as to read to the end of the string. This is why the print() command displays everything starting from M (i.e., the 25th indexed position in cems) to the last character !.
๐ŸŒ
Real Python
realpython.com โ€บ python-print
Your Guide to the Python print() Function โ€“ Real Python
July 3, 2026 - The code snippet above runs within an interactive Python REPL, as indicated by the prompt (>>>). Because the REPL executes each line of Python code immediately, you see a blank line right after calling print(). On the other hand, when you skip the trailing parentheses, you get to see a string representation of the print() function itself.
๐ŸŒ
Medium
medium.com โ€บ @DoneWithWork โ€บ 5-different-ways-to-print-in-python-17528bb5c173
5 Different Ways to Print in Python | by DoneWithWork | Medium
May 2, 2023 - # Example 1: Printing a string print("Hello, World!") # Output: Hello, World! # Example 2: Printing a variable x = 42 print(x) # Output: 42 ยท String formatting is a powerful technique that allows you to insert values into a string. In Python, you can use the โ€˜%โ€™ operator to format a string.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
How to Use print() in Python | note.nkmk.me
May 10, 2023 - This article focuses on the Python 3 print() function. You can display strings or numbers by passing them as arguments to the print() function.
๐ŸŒ
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?

๐ŸŒ
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' ...
๐ŸŒ
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
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ string.html
string โ€” Common string operations
'left<<<<<<<<<<<<' '^^^^^center^^^^^' '>>>>>>>>>>>right' >>> >>> octets = [192, 168, 0, 1] >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets) 'C0A80001' >>> int(_, 16) 3232235521 >>> >>> width = 5 >>> for num in range(5,12): ... for base in 'dXob': ... print('{0:{width}{base}}'.format(num, base=base, width=width), end=' ') ... print() ... 5 5 5 101 6 6 6 110 7 7 7 111 8 8 10 1000 9 9 11 1001 10 A 12 1010 11 B 13 1011 ... The feature described here was introduced in Python 2.4; a simple templating method based upon regular expressions. It predates str.format(), formatted string literals, and template string literals.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-output-using-print-function
Python - Print Output using print() function - GeeksforGeeks
You can pass variables, strings, numbers, or other data types as one or more parameters when using the print() function. Then, these parameters are represented as strings by their respective str() functions.
Published: July 11, 2025