Your first Python program needs just one line. print() shows a message in the output:
print("Hello, World!")It prints:
Hello, World!
The words inside the quotes are the message. Change them to anything you like and Python will print your version instead. Keep print lowercase and the parentheses around the message.
Ready to make it yours? The first puzzle gives you a name and asks you to print a greeting. The starter code reads the name for you; you only need to write the print() line. You can look up the examples below whenever you need them.
More ways to print: multiple items, numbers, and comments
Printing more than one thing
Give print() several arguments separated by commas and it prints them all, with a space between each:
print("Python", "is", "fun")Output:
Python is fun
Two optional arguments let you change how print() behaves. You can try sep in the first puzzle:
| Argument | What it controls | Default |
|---|---|---|
sep | What goes between items | a single space |
end | What goes after the last item | a new line |
print("2025", "06", "01", sep="-")
print("Loading", end="...")
print("done")Output:
2025-06-01
Loading...done
Every print() normally starts a new line. Setting end="" or end="..." keeps the next print on the same line.
Numbers don't need quotes, and Python will do the math before printing:
print(2 + 3)
print("2 + 3")Output:
5
2 + 3
The first line is a calculation. The second is just text, so Python prints it exactly as written.
Comments
Anything after a # is a comment. Python ignores it, so you can leave notes for yourself and other people.
# This line is ignored by Python
print("Comments are useful") # You can also put them at the end of a lineGood comments explain why you did something, not just what the code does.
Tip
Comments are also handy for switching a line off while you debug. Put a # in front of it and Python skips it.
A note about the puzzles
In the first few puzzles, the starter code already contains lines like name = input(). That line reads the text from the Input box so you don't have to. You'll learn how input() works in lesson 4. For now, just use the variables it creates.
The second puzzle builds on the first: use print() to put words on one line and then on separate lines.
Why is the first program always 'Hello, World!'?
It's a tradition that goes back to a 1970s programming book. Printing a greeting is the smallest program that shows how output happens.