Print multiple arguments in Python
Here is an example of how to print multiple arguments in Python:
Here is an example of how to print multiple arguments in Python:
Print multiple arguments in Python
# Using the print function with multiple arguments separated by a comma
print("Hello,", "world!")
# Using the format method
print("Hello, {}!".format("world"))
<div class="alert alert-info flex not-prose">![]()
<span class="hidden md:block">Watch a video course</span>Python - The Practical Guide</div>
Both of the above code snippets will output:
Hello, world!You can also use f-strings (formatted string literals) which were introduced in Python 3.6:
Use f-strings in print in Python
# Using f-strings
print(f"Hello, {'world'}!")This will also output the same output as above.