Shiklo Tools
PDF40
Image20
Calculators & Converters25
Text & Writing13
Developer26
Video14
Audio14
Document14
Data & Spreadsheet12
Web & SEO9
OCR & Scanning5
Archive & File12
Security & Privacy23
Health & Medical29
QR & Barcode5

Python Output (print)

To show something on the screen, Python programs use the built-in function print. It writes its values to the terminal and then moves to a new line. You will use print in almost every program, so it is worth knowing its options.

Printing several values

print can take several values separated by commas. It prints them on one line with a space between them. The values can be text, numbers, or anything else:

print("Hello")
print("I am", 21, "years old")
print(3.5, True, "done")
print()
print("The line above is empty.")
Output
Hello
I am 21 years old
3.5 True done

The line above is empty.

print() with nothing inside prints an empty line. Numbers are printed as they are, without quotes.

The sep and end options

Two optional arguments change how print joins and ends its output. sep is the text put between the values (a space by default), and end is the text put after the last value (a new line by default):

print("2026", "10", "21", sep="-")
print("Loading", end="")
print("...", end=" ")
print("done")
print("a", "b", "c", sep="")
Output
2026-10-21
Loading... done
abc

With end="" the next print continues on the same line. This is useful for building a line in several steps.

Escape sequences

Some characters cannot be typed directly inside a string. A backslash starts an escape sequence: \n is a new line, \t is a tab, \" is a double quote inside a double-quoted string, and \\ is a backslash itself:

print("Line one\nLine two")
print("Name:\tAsha")
print("She said \"hello\"")
print("C:\\Users\\asha")
Output
Line one
Line two
Name:	Asha
She said "hello"
C:\Users\asha

You can also use single quotes around a string that contains double quotes, 'She said "hello"', and the other way round. Both kinds of quotes make the same kind of string.

Practice exercises

  1. Print your name, your age and your city on one line using one print with three values.
  2. Print the date 21/10/2026 using sep.
  3. Print the numbers 1 to 5 on one line, separated by spaces, using five print calls with end.
  4. Print a small table with two columns separated by \t.