Python Output
Output is the result a program shows on the screen. The print() function shows values as output.
Print several values
Commas print each value with a space after it.
print("Name:", "Ada", "Score:", 95)Join text with plus
The plus sign joins strings with no extra space. It works with text, not numbers.
print("Py" + "thon")Change the separator
sep="-" puts a dash between the values.
print("2026", "10", "22", sep="-")Stay on the same line
end="..." stops the new line at the end. The next print continues on that line.
print("Loading", end="...")
print("done")Example
print("----- Receipt -----")
print("Apples", 4, sep=": ")
print("Total cost:", 8)Key points
- Use print() to show values on the screen
- Use commas to print several values with spaces between them
- Use + to join strings with no space between them
- Keyword argument: a named setting inside the brackets, like sep=
- Use sep= to choose what goes between values
- Use end= to choose what goes after the values
In this example, the first line prints a receipt header. The second line prints a label and a count. The sep setting puts a colon and a space between them. The third line prints the total cost as a number.
Note
Numbers print without quotes.
Quotes would make them text instead.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Python Playground
Exercise
What does sep="-" do in print()?