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}')
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python 3 tutorial › python 3 print
Python 3 print | Definition | Overviews | Parameters | Function
March 30, 2023 - ... print (function) (value(s), ... parameter), flush=flush (optional parameter)) The print method in Python accepts any number of parameters and prints them on a single line of text....
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-print-function
Python print() function - GeeksforGeeks
Note: The parameters sep, end, file, and flush in the print() function are keyword-only arguments. This means they must be specified using their parameter names, not by position. Example 2: This example prints multiple objects but uses a custom ...
Published: March 7, 2026
🌐
Software Testing Help
softwaretestinghelp.com › home › python › complete guide to python print() function with examples
Complete Guide To Python print() Function With Examples
April 1, 2025 - ``` demolist = [ 1, 1, 2, 2, 3, 4, 5, 6, 7, 8] print(“Output: ”) print(demolist) ``` ... In Python, the arguments are the values that we passed in the function when it is called.
🌐
Delft Stack
delftstack.com › home › howto › python › how to print multiple arguments in python
How to Print Multiple Arguments in Python | Delft Stack
March 11, 2025 - In Python 3, the print() function is the go-to method for printing multiple arguments. Unlike Python 2, where print was a statement, Python 3 treats it as a function, allowing for more flexibility.
🌐
Python.org
discuss.python.org › python help
Where can I find a comprehensive list of ALL print() arguments? - Python Help - Discussions on Python.org
September 16, 2022 - Where is the official definition of all the functions built into Python, including all arguments and what they do? Specifically, I would like to know all available options for the print() function using sys.stdout. Ther…
🌐
Python documentation
docs.python.org › 3 › tutorial › inputoutput.html
7. Input and output — Python 3.15.0 documentation
>>> table = {'Sjoerd': 4127, 'Jack': ... Sjoerd: 4127; Dcab: 8637678 · This could also be done by passing the table dictionary as keyword arguments with the ** notation....
🌐
Programiz
programiz.com › python-programming › methods › built-in › print
Python print()
Default value: False · Note: sep, end, file, and flush are keyword arguments. If you want to use sep argument, you have to use: ... It doesn't return any value; returns None. print("Python is fun.") a = 5 # Two objects are passed ... Python is fun. a = 5 a = 5 = b · In the above program, ...
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › how-to-print-multiple-arguments-in-python
How to Print Multiple Arguments in Python?
August 29, 2023 - Convert non-string values and concatenate with the + operator ? number = 42 is_valid = True print("Number: " + str(number) + ", Valid: " + str(is_valid)) ... def print_info(*args, **kwargs): print("Positional arguments:", *args) for key, value in kwargs.items(): print(f"{key}: {value}") print_info("Alice", 30, city="Boston", role="Developer") Positional arguments: Alice 30 city: Boston role: Developer · Use f-strings for modern Python applications as they offer the best readability and performance.
🌐
Real Python
realpython.com › python-print
Your Guide to the Python print() Function – Real Python
July 3, 2026 - While you don’t pass any arguments to print(), you still need to put empty parentheses at the end of the line to tell Python to actually execute that function rather than just refer to it by name.
🌐
W3Schools
w3schools.com › python › ref_func_print.asp
Python print() Function
Python Examples Python Compiler ... Plan Python Interview Q&A Python Training ... The print() function prints the specified message to the screen, or other standard output device....
🌐
LinkedIn
linkedin.com › pulse › print-function-arguments-manish-v-
Print Function With Arguments
January 20, 2024 - One of the most common errors is forgetting to include parentheses when using print(). In Python 3, print is a function, so it requires parentheses even if you're not passing any arguments.
🌐
Python Morsels
pythonmorsels.com › print-features
The power of Python's print function - Python Morsels
August 3, 2026 - You could pass multiple arguments to print instead: >>> language = "English" >>> print("Current language:", language) Python's f-strings are great, but if you just need to smoosh a few values together with spaces between them, consider passing ...
🌐
W3docs
w3docs.com › home › code snippets › python › print multiple arguments in python
Print multiple arguments in Python | W3docs
Print multiple arguments in Python ... f-strings (formatted string literals) which were introduced in Python 3.6: Use f-strings in print in Python ·...
🌐
LabEx
labex.io › tutorials › python-how-to-print-multiple-arguments-in-python-418811
How to print multiple arguments in Python | LabEx
Python's print() function allows you to pass multiple arguments easily, providing flexibility in output formatting.
🌐
Mimo
mimo.org › glossary › python › print-function
Explore Python's print() function, master output customization
In Python, you use the built-in print() function to display output to the console. You can pass it one or more arguments, which will be converted to strings and printed. By default, it separates multiple items with a space and adds a newline at the end.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-print-multiple-arguments-in-python
How to Print Multiple Arguments in Python? - GeeksforGeeks
July 23, 2025 - The **kwargs parameter allows passing multiple keyword arguments as a dictionary. The function iterates over key-value pairs and prints them.
🌐
LearnPython.com
learnpython.com › blog › python-print-function
A Complete Guide to the Python print() Function | LearnPython.com
January 25, 2022 - A good reference for how the Python print() function works is in the official documentation. The function accepts several arguments as shown below with their default values:
🌐
Python Engineer
python-engineer.com › posts › print-function
Tip - The print function can take additional arguments - Python Engineer
The file argument must be an object with a write(string) method; if it is not present or None, sys.stdout will be used. f = open("test.txt", "a") print("This goes into a file", file=f) f.close()