The Wayback Machine - https://web.archive.org/web/20250131230711/https://www.geeksforgeeks.org/g-fact-25-print-single-multiple-variable-python/
Open In App

Print Single and Multiple variable in Python

Last Updated : 09 Jan, 2025
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

In Python, printing single and multiple variables refers to displaying the values stored in one or more variables using the print() function. This is a basic way to see the output of our code or debug our program.

Printing a Single Variable in Python

In Python, the print() function is used to display output on the console. If we want to print the value of a single variable, we can pass that variable to the print() function.

Example:

Python
# Assign a value to a variable
x = 42

# Print the value of the variable
print(x)

Output
42

Printing Multiple Variables in Python

In Python, we can print multiple variables using the print() function by separating the variables with commas or by formatting the output with f-strings or the .format() method.

Python
# Define multiple variables
a = 10
b = 20
c = 30

# Print multiple variables
print(a, b, c)

Output
10 20 30




Next Article
Article Tags :
Practice Tags :

Similar Reads

three90RightbarBannerImg