There are many ways to do this. To fix your current code using %-formatting, you need to pass in a tuple:

  1. Pass it as a tuple:

    print("Total score for %s is %s" % (name, score))
    

A tuple with a single element looks like ('this',).

Here are some other common ways of doing it:

  1. Pass it as a dictionary:

    print("Total score for %(n)s is %(s)s" % {'n': name, 's': score})
    

There's also new-style string formatting, which might be a little easier to read:

  1. Use new-style string formatting:

    print("Total score for {} is {}".format(name, score))
    
  2. Use new-style string formatting with numbers (useful for reordering or printing the same one multiple times):

    print("Total score for {0} is {1}".format(name, score))
    
  3. Use new-style string formatting with explicit names:

    print("Total score for {n} is {s}".format(n=name, s=score))
    
  4. Concatenate strings:

    print("Total score for " + str(name) + " is " + str(score))
    

The clearest two, in my opinion:

  1. Just pass the values as parameters:

    print("Total score for", name, "is", score)
    

    If you don't want spaces to be inserted automatically by print in the above example, change the sep parameter:

    print("Total score for ", name, " is ", score, sep='')
    

    If you're using Python 2, won't be able to use the last two because print isn't a function in Python 2. You can, however, import this behavior from __future__:

    from __future__ import print_function
    
  2. Use the new f-string formatting in Python 3.6:

    print(f'Total score for {name} is {score}')
    
Answer from Blender on Stack Overflow
Top answer
1 of 14
699

There are many ways to do this. To fix your current code using %-formatting, you need to pass in a tuple:

  1. Pass it as a tuple:

    print("Total score for %s is %s" % (name, score))
    

A tuple with a single element looks like ('this',).

Here are some other common ways of doing it:

  1. Pass it as a dictionary:

    print("Total score for %(n)s is %(s)s" % {'n': name, 's': score})
    

There's also new-style string formatting, which might be a little easier to read:

  1. Use new-style string formatting:

    print("Total score for {} is {}".format(name, score))
    
  2. Use new-style string formatting with numbers (useful for reordering or printing the same one multiple times):

    print("Total score for {0} is {1}".format(name, score))
    
  3. Use new-style string formatting with explicit names:

    print("Total score for {n} is {s}".format(n=name, s=score))
    
  4. Concatenate strings:

    print("Total score for " + str(name) + " is " + str(score))
    

The clearest two, in my opinion:

  1. Just pass the values as parameters:

    print("Total score for", name, "is", score)
    

    If you don't want spaces to be inserted automatically by print in the above example, change the sep parameter:

    print("Total score for ", name, " is ", score, sep='')
    

    If you're using Python 2, won't be able to use the last two because print isn't a function in Python 2. You can, however, import this behavior from __future__:

    from __future__ import print_function
    
  2. Use the new f-string formatting in Python 3.6:

    print(f'Total score for {name} is {score}')
    
2 of 14
64

There are many ways to print that.

Let's have a look with another example.

a = 10
b = 20
c = a + b

#Normal string concatenation
print("sum of", a , "and" , b , "is" , c) 

#convert variable into str
print("sum of " + str(a) + " and " + str(b) + " is " + str(c)) 

# if you want to print in tuple way
print("Sum of %s and %s is %s: " %(a,b,c))  

#New style string formatting
print("sum of {} and {} is {}".format(a,b,c)) 

#in case you want to use repr()
print("sum of " + repr(a) + " and " + repr(b) + " is " + repr(c))

EDIT :

#New f-string formatting from Python 3.6:
print(f'Sum of {a} and {b} is {c}')
๐ŸŒ
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.
๐ŸŒ
IncludeHelp
includehelp.com โ€บ python โ€บ print-multiple-variables.aspx
Print multiple variables in Python
April 20, 2025 - Here, we have to specify the curly braces ({}) where we have to print the values and in the format() method, provide the multiple variables separated by the commas. print("{} {} {}".format(variable1, variable2, variable2) # Python program to print multiple variables # using format() method ...
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ need help printing multiple variables with a loop
r/learnpython on Reddit: Need help printing multiple variables with a loop
January 5, 2023 -

I want to print an undefined amount of variables that are named like this: var_1, var_2, var_3, etc.

I created a for loop which runs a specific amount of times depending on how many variables there are:

count = 1

for i in range(x):

print("var_" + str(count))

count += 1

However this prints the variables by their name and not the integer/string they are defined to earlier. I was hoping someone could tell me if there is a way to fix this, or a better way to do it.

๐ŸŒ
Appdividend
appdividend.com โ€บ print-single-and-multiple-variables-in-python
How to Print Single and Multiple Variables in Python
February 6, 2025 - To print single or multiple variables in Python, use either the f-strings or the print() function. They are fast and efficient.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ printing multiple objects on one line
r/learnpython on Reddit: Printing multiple objects on one line
September 19, 2025 -

I'm currently working on a college assignment and I have to display my first and last name, my birthday, and my lucky number in the format of "My name is {first name} {last name}. I celebrate my birthday on {date of birth}, and my lucky number is {lucky number}!"

Here is what I've cooked up with the like hour of research of down, can anyone help me get it into the format above?

import datetime
x = "Nicholas"
y = "Husnik"
z = str(81)
date_obj = datetime.date(2005, 10, 0o6)
date_str = str(date_obj)
date_str2 = date_obj.strftime("%m/%d/%y")
print("Hello, my name is " + x + " " + y +".")
print("My birthday is on:")
print(date_str2, type(date_str2))
print("My lucky number is " + z + ".")

๐ŸŒ
Altcademy
altcademy.com โ€บ blog โ€บ how-to-print-variables-in-python
How to print variables in Python - Altcademy.com
September 4, 2023 - Python has a built-in function called print() that we can use to do this. ... If you run this code, you should see 10 printed on your screen. This is because the print() function is like saying, "Look at what's inside the box!"
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_variables_multiple.asp
Python Variables - Assign Multiple Values
Note: Make sure the number of variables matches the number of values, or else you will get an error. And you can assign the same value to multiple variables in one line: x = y = z = "Orange" print(x) print(y) ...
๐ŸŒ
Crained
crained.com โ€บ home โ€บ how to return or print multiple variables in python
How to return or print multiple variables in Python - Crained
February 20, 2026 - And finally, this f-string formatting works to print multiple variables for Python 3.6 and higher.
๐ŸŒ
CodeVsColor
codevscolor.com โ€บ 5 different ways to print multiple values in python - codevscolor
5 different ways to print multiple values in Python - CodeVsColor
September 15, 2021 - Starting from python 3, we can also use f-string or formatted string literals to print multiple variables in a single line:
๐ŸŒ
Quora
quora.com โ€บ How-do-you-print-multiple-values-in-Python
How to print multiple values in Python - Quora
Python (programming langu... ... Computer Science and Prog... ... Printing multiple values in Python can be done several ways depending on desired formatting and performance.
๐ŸŒ
FACE Prep
faceprep.in โ€บ home โ€บ placement prep โ€บ printing variables in python: single, multiple, formatted
Printing Variables in Python: Single, Multiple, Formatted
May 9, 2026 - Use print(variable) in Python 3; parentheses are required and omitting them throws a SyntaxError. Separate multiple variables with commas inside print() and Python inserts a space between each value automatically.
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ 5 best ways to print single and multiple variables in python
5 Best Ways to Print Single and Multiple Variables in Python - Be on the Right Side of Change
February 28, 2024 - Python supports printing of tuples directly. By passing variables as a tuple to the print function, Python prints each element of the tuple separated by spaces. This method is quick for outputting multiple variables without formatting.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ python-how-to-print-multiple-variables-safely-419817
How to print multiple variables safely | LabEx
This tutorial explores safe and robust methods for printing variables, addressing common challenges developers face when working with complex data outputs. Printing is a fundamental operation in Python that allows developers to output information to the console. The print() function is the primary method for displaying data during program execution, making it crucial for debugging, logging, and user interaction.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-print-multiple-arguments-in-python
How to Print Multiple Arguments in Python?
August 29, 2023 - name = "Alice" age = 25 city = "New York" print("Name:", name, "Age:", age, "City:", city) print(name, age, city, sep=" | ") Name: Alice Age: 25 City: New York Alice | 25 | New York ยท F-strings provide the most readable and efficient way to format multiple arguments ? name = "Bob" course = "Python" duration = 6 print(f"Hello {name}, you're enrolled in {course} for {duration} months") print(f"Progress: {85}% complete")