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 runNeed input()? Add one value per line
Your output appears here.
Quick quiz
Three questions. You can change your answers and try again.
Typical mistakes
Everyone meets these errors. See what causes them and how to fix them.
Unquoted text
print(Hello)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
print "Hello"print("Hello")What happens: SyntaxError in Python 3.
print is a function, so its argument goes inside parentheses.