Camp 1 · Schritt 3 von 23
Printing and messages
Master print — combining values, blank lines, and the little tricks that make output readable.
You've already used print — now let's make it work harder. Nearly every
program you write on this trail starts by printing something, so a few
minutes here pays off everywhere.
Printing several things at once
Give print multiple values separated by commas, and it prints them all on
one line with spaces in between:
Notice two things:
- Text needs quotes, numbers don't.
- Python adds the space between values for you.
Blank lines and spacing
An empty print() prints an empty line — perfect for separating sections of
output:
Quotes: single or double?
Python accepts both 'single' and "double" quotes for text. They mean
exactly the same thing — pick one and stay consistent. The one rule: end
with the same quote you started with.
print('This works')
print("This works too")
print("Don't mix them up") # double quotes let you use ' insideThat last line shows a genuinely useful trick: if your text contains an apostrophe, wrap it in double quotes.
Which line prints the text: It's sunny
What does print(2, 3) show?
What's next
You can make output — next you'll learn to leave notes in your code with comments, and read Python's error messages without breaking a sweat.