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.
print() FunctionThe print() function is used to display text, numbers, variables, and other data types on the screen.
print(object(s), sep=separator, end=end_character)
print()object(s) The data to be printed (strings, numbers, variables, etc.)
sep (optional)
Specifies the separator between multiple values
Default value: space " "
end (optional)
Specifies what to print at the end
Default value: newline \n
print("Hello, World!")
Output
Hello, World!
Explanation
print("Python", "is", "easy")
Output
Python is easy
Explanation
sep Parameterprint("2026", "03", "20", sep="-")
Output
2026-03-20
Explanation
-.end Parameterprint("Hello", end=" ")
print("World")
Output
Hello World
Explanation
print() does not move to a new line.name = "Rahul"
age = 20
print("Name:", name)
print("Age:", age)
Output
Name: Rahul
Age: 20
print(10)
print(3.14)
print(True)
Output
10
3.14
True
name = "Amit"
marks = 85
print(f"Name: {name}, Marks: {marks}")
Output
Name: Amit, Marks: 85
Explanation
print("Hello\nWorld")
Output
Hello
World
Common Escape Characters
| Escape | Meaning |
|---|---|
\n |
New line |
\t |
Tab space |
\\ |
Backslash |
print() is used to display output in Python.sep controls separation between values.end controls what is printed at the end.