Python – Output Variables

1. What Does “Output Variables” Mean?

Output variables means showing the value of a variable on the screen.

In Python, we use the print() function to do this.

2. Printing a Single Variable

You can print a variable directly.

Example

age = 20
print(age)

Output:

20

3. Printing Text with a Variable

Example

name = "Ravi"
print("Name is", name)

Output:

Name is Ravi

Python automatically adds a space.

4. Printing Multiple Variables Together

You can print more than one variable at the same time.

Example

name = "Anita"
age = 22
city = "Delhi"

print(name, age, city)

Output:

Anita 22 Delhi

5. Using + to Output Variables

When using +, text and number cannot be joined directly.

❌ Wrong Example

age = 25
print("Age is " + age)

This causes an error.

✔ Correct Example

age = 25
print("Age is " + str(age))

6. Using Comma (Best for Beginners)

Using comma is easy and safe.

Example

price = 199
print("Price:", price)

Output:

Price: 199

7. Printing Calculations with Variables

Example

a = 10
b = 5

print("Sum:", a + b)
print("Product:", a * b)

8. Printing Variables on New Lines

Each print() goes to a new line.

Example

x = 1
y = 2

print(x)
print(y)

9. Printing Variables in One Line

Example

x = 5
y = 10

print(x, y)

10. Common Beginner Mistakes

❌ Printing Variable Name as Text

name = "Amit"
print("name")

Output:

name

✔ Correct:

print(name)

❌ Forgetting Quotes

print(Hello)

✔ Correct:

print("Hello")

11. Simple Practice Examples

Example 1: Print Student Info

student = "Rahul"
marks = 85

print("Student:", student)
print("Marks:", marks)

Example 2: Print Area

length = 10
width = 5

print("Area:", length * width)

Example 3: Print User Input

city = input("Enter city name: ")
print("You live in", city)

12. Summary (Output Variables)

✔ Variables store values
print() shows variable values
✔ Use comma to print text + variable
✔ Use str() when using +
✔ Keep output simple and clean

📘 Perfect for Beginner eBook

This chapter is ideal for:

  • Python beginner books

  • School & college students

  • Self-learners

If you want next, I can write:

  • Python Input Variables

  • Python Data Types

  • Operators

  • if–else statements

  • Loops (for, while)

Just tell me 😊

You may also like...