Lessons
Courses

Printing in Python [ English ]

1. Introduction

In Python, printing refers to displaying output on the screen. This is done using the built-in print() function. It is one of the most commonly used functions and is essential for displaying messages, results, and program outputs.

2. The print() Function

The print() function is used to display text, numbers, variables, and other data types on the screen.

Syntax

print(object(s), sep=separator, end=end_character)

3. Parameters of print()

  1. object(s)The data to be printed (strings, numbers, variables, etc.)

  2. sep (optional)Specifies the separator between multiple valuesDefault value: space " "

  3. end (optional)Specifies what to print at the endDefault value: newline \n

4. Basic Example

print("Hello, World!")

Output

Hello, World!

Explanation

  • This statement prints a simple message on the screen.

5. Printing Multiple Values

print("Python", "is", "easy")

Output

Python is easy

Explanation

  • Multiple values are separated by a space by default.

6. Using sep Parameter

print("2026", "03", "20", sep="-")

Output

2026-03-20

Explanation

  • The separator between values is changed to -.

7. Using end Parameter

print("Hello", end=" ")print("World")

Output

Hello World

Explanation

  • The first print() does not move to a new line.

8. Printing Variables

name = "Rahul"age = 20 print("Name:", name)print("Age:", age)

Output

Name: RahulAge: 20

9. Printing Different Data Types

print(10)print(3.14)print(True)

Output

103.14True

10. Using Formatted Strings (f-strings)

name = "Amit"marks = 85 print(f"Name: {name}, Marks: {marks}")

Output

Name: Amit, Marks: 85

Explanation

  • f-strings allow embedding variables inside strings.

11. Printing Escape Characters

print("Hello\nWorld")

Output

HelloWorld

Common Escape Characters

EscapeMeaning
\nNew line
\tTab space
\\Backslash

12. Summary

  • print() is used to display output in Python.
  • It can print text, numbers, variables, and expressions.
  • sep controls separation between values.
  • end controls what is printed at the end.
  • It supports formatted output using f-strings.
  • It is essential for debugging and user interaction.