Run Your First Python Command-Line App
Computer Science
Run Your First Python Command-Line App
Run Your First Python Command-Line App
Create one tiny Python program, run it from a terminal, and see your own message appear.
What you learn by building this
Build it yourself, get guided when you are stuck, and leave with proof you can actually show.
Learning Journey
Build and Run Hello World
1 lessonWrite a Python script and reach the executable milestone: running it successfully from the command line.
Public lesson
Create and Run a Python Hello-World App
Tasks
Open a terminal:
- Windows: PowerShell or Command Prompt
- macOS: Terminal
- Linux: Terminal
Run:
python --version
python --version
You should see something like Python 3.12.2.
Tasks
If that command fails, try:
python3 --version
python3 --version
On Windows, you can also try:
py --version
py --version
Remember which command worked—you’ll use it again.
Tasks
If none works, install Python 3 from python.org/downloads, reopen the terminal, and repeat the check.
Tasks
In the terminal, run these commands one at a time:
mkdir python-hello
cd python-hello
mkdir python-hello
cd python-hello
Check your location:
- Windows:
dir - macOS/Linux:
pwd
The folder name or path should include python-hello.
Tasks
Open a plain-text or code editor and create a file named exactly:
hello.py
hello.py
Save it inside the python-hello folder. Make sure it is not named hello.py.txt.
Python displays text with print(). For example:
print("Python is ready.")
print("Python is ready.")
Tasks
Using that pattern, type two statements in hello.py:
- The first must print exactly
Hello, world! - The second must print a sentence personalized with your name or an interest, such as introducing your name
Keep quotation marks around each line of text. Save the file.
Tasks
Return to the terminal. Use the Python command that worked earlier:
python hello.py
python hello.py
Or:
python3 hello.py
python3 hello.py
Or on Windows:
py hello.py
py hello.py
Your terminal should show two lines in this shape:
Hello, world!
[your personalized sentence]
Hello, world!
[your personalized sentence]
Check the first line carefully: it needs the capital H, comma, space, and exclamation mark.
Tasks
- “No such file” or “can’t open file”: confirm the terminal is inside
python-hello, then list its files withdirorls.
Tasks
SyntaxError: check that both strings have matching quotation marks and both calls have closing parentheses.
Tasks
- Only one line appears: confirm the file contains two separate
print()calls, then save and run it again.
Course Outline
1 module · 1 lesson
Build and Run Hello World
Learn by building your own version.
Remix this public project to open the workspace, follow the guided build, and let the AI mentor teach you through the work instead of doing it for you.