Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 0.4 — Run Your First Program: Here, Then on Your Computer
Python · Example 2 of 2

Your first program, a little bigger

Commas inside print put a space between the parts. An empty print() gives a blank line.

You can run Python on this page with the Run button and nothing installed. To work on your own computer, install Python from python.org, save your code in a file ending in .py, and run it from a terminal with python hello.py (python3 on macOS and Linux).

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write a program that prints your name on the first line, your city on the second, a blank line, and then 7 * 6 = followed by the answer.

02

Write one print that shows Python is fun using three separate pieces of text separated by commas.

03

Write the three terminal commands, in order, to check the Python version, move into a folder called projects, and run app.py.

Explain it without notes

01

What does the command python hello.py do, step by step?

02

Why is the command python3 on macOS and Linux but python on Windows?

03

The terminal says can't open file ... No such file or directory. Is your program wrong? What do you check?

04

What is the difference between a code editor and the interpreter?

Your first program, a little bigger
Sign in to run this example in your browser.

Expected output

Hello! My name is Asha.
I am learning Python today.

2 + 3 = 5
Days in a week times 2: 14