👋 Getting Started, lesson 2 of 5
More ways to print
Print several values at once and control spacing and line endings.
8 min
1 exercise
2 quizzes
0/3 solved
Getting Python ready… examples can run in a moment.
You can give print() several values separated by
commas. Python prints them on one line with a space
between each one. You can mix text and numbers freely.
Several values
Notice the spaces Python adds between values. Add another value to the first line.
Two optional settings change how print() behaves:
sep="..."sets what goes between values (a space by default).end="..."sets what goes after the last value (a new line by default).
sep and end
Try sep="" or sep=" | ". What does end="" do?
What does this print?
Inside a string, a backslash starts a special character called an escape sequence:
\nstarts a new line\tinserts a tab\"puts a double quote inside a string
Calling print() with nothing inside prints an empty
line.
Escape sequences
Strings can use "double" or 'single' quotes, as long as both ends match.
What does this print?
Format a date
Change the print call so it prints the date with
slashes, exactly like this:
30/09/2026
Keep the three separate values and use sep.