How to print multiple variables?

QuestionsQuestions8 SkillsProYour First Python LabSep, 22 2025
0112

To print multiple variables in Python, you can use the print() function and separate the variables with commas. Here's an example:

name = "Alice"
age = 30
city = "Wonderland"

print(name, age, city)

This will output:

Alice 30 Wonderland

You can also format the output for better readability using f-strings (Python 3.6 and above):

print(f"{name} is {age} years old and lives in {city}.")

This will output:

Alice is 30 years old and lives in Wonderland.

Feel free to ask if you need more examples or explanations!

0 Comments

no data
Be the first to share your comment!