🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Python Notes
Topic #12

Output Variables


Output Variables

The print() function is often used to output variables.

Example

x = "Python is awesome"
print(x)

In the print() function, you output multiple variables, separated by a comma:

Example

  x = "Python"
y = "is"
z = "awesome"
print(x, y, z)

You can also use the + operator to output multiple variables:

Example

x = "Python "
y = "is "
z = "awesome"
print(x
  + y + z)

Note: Notice the space character after "Python " and "is ", without them the result would be "Pythonisawesome".

For numbers, the + character works as a mathematical operator:

Example

x = 5
y = 10
print(x + y)

In the print() function, when you try to combine a string and a number with the + operator, Python will give you an error:

Example

  x = 5
y = "John"
print(x + y)

The best way to output multiple variables in the print() function is to separate them with commas, which even support different data types:

Example

x = 5
y = "John"
print(x, y)

Want to go beyond the notes?

Join CodingNow 2.0's Python course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Output Variables – FAQs

Quick answers about learning Output Variables in Python.

This free note from CodingNow 2.0 explains Output Variables in Python — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Python topic on CodingNow 2.0, including Output Variables, is 100% free with no signup required.
With focused practice, most students grasp Output Variables in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now