LESSON 01 · BEGINNER PATH6 min

Hello, World!

Run your first Python statements and recognize how Python displays output.

The video is in production

An English walkthrough for this topic is planned. You can work through the full lesson and run its code now.

Understand the concept

A Python program runs its statements from top to bottom. The print function sends a value to the output area, so it is a quick way to check what your code does.

Text is a string and needs quotes. Numbers can be written without quotes. Lines beginning with a hash sign are comments for people reading the code.

  • print() displays a value
  • Strings use quotes
  • Comments begin with #

Try it in Python

Edit the example and run it. Python starts in your browser the first time you click Run.

Python console

Ready to run
Need input()? Add one value per line
Ctrl / ⌘ + Enter to run
OUTPUT
Your output appears here.
Your turnChange the greeting to include your name. Then print the result of 7 + 5 on a new line.

Quick quiz

Three questions. You can change your answers and try again.

01.What does print("Hi") display?

02.Which character begins a Python comment?

03.What does print(3 + 4) display?

Typical mistakes

Everyone meets these errors. See what causes them and how to fix them.

Unquoted text

COMMON MISTAKE
print(Hello)
FIX
print("Hello")

What happens: NameError: Python looks for a variable named Hello.
Put literal text inside quotes so Python treats it as a string.

Missing parentheses

COMMON MISTAKE
print "Hello"
FIX
print("Hello")

What happens: SyntaxError in Python 3.
print is a function, so its argument goes inside parentheses.