Free lab Real Python 3. Zero installs. Your code stays in this browser. Open the playground

Hello, Python!

8 min 20 XP
Study loop Read Predict Run Tweak Prove Review
Lesson 1 of 7 · View course roadmap
Step 1

Learn the idea

Python is the world's most popular programming language — used by NASA, Netflix, Instagram and millions of developers. It reads almost like English, which makes it the perfect first language.

The print() function displays text on the screen. Text wrapped in quotes is called a string:

Lines starting with # are comments — notes for humans that Python ignores completely. Use them to explain why your code does something.

  • print("text") — outputs text
  • # comment — ignored by Python
  • You can print several values: print("a", "b") puts a space between them

Where you'll use this

print() is a developer's first debugging tool — professionals sprinkle prints to inspect running programs before reaching for real debuggers, and every CLI tool you've ever used writes its output exactly this way.

Common mistakes

  • Forgetting the parentheses: print "hi" worked in Python 2 but is a SyntaxError in Python 3.
  • Mismatched quotes: print("hello') — start and end with the same quote character.
  • Writing code after a comment on the same line and expecting it to run — everything after # is ignored.

Pro tip

print() accepts a sep= and end= argument: print("a", "b", sep="-", end="!") gives a-b!. You'll use end="" whenever you want to print without a newline.

Step 2

Watch how it runs — line by line


        

Press play to watch Python execute this code, one line at a time.

Step 3

Try it yourself

Blank · autosaved

The lesson example is loaded and ready — press Run, then change something and run it again. Breaking it is part of learning. Want a clean slate? Tap “New blank”.

PYexample.py
+ Enter to run
Output appears here…
Step 4

Pass the challenge +20 XP

Blank · autosaved

Print exactly two lines: first Hello, Python! and then I am learning to code.

Target output
Hello, Python!
I am learning to code
PYchallenge.py
Run your code to check it…
Step 5

Check your understanding

1. Which line correctly prints text in Python?
2. What does the # symbol do?
Last step

Your notes (saved on this device)

Tip: use and to move between lessons, K to search everything.

Your next ten minutes

Write Python that does something useful.

Start free. No install, no card, no passive video marathon.

Start learning free → Explore the path