Python Hello-World CLI
Computer Science
Python Hello-World CLI
Python Hello-World CLI
Build and run your first tiny Python program in one hands-on session. You will create a command-line app that prints a friendly greeting.
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
Create a Runnable Python App
1 lessonWrite a Python script and successfully run it from the command line.
Public lesson
Build and Run Hello World
Tasks
1. Check that Python is available
Open a terminal and try:
python --version
python --version
If that fails, try:
python3 --version
python3 --version
On Windows, you can also try:
py --version
py --version
Use whichever command prints a version such as Python 3.12.2. Remember that working command—you’ll use it again.
If none work, install Python 3 from python.org/downloads, reopen the terminal, and retry.
Tasks
2. Create the file
In the terminal, create and enter a project folder:
mkdir python-hello
cd python-hello
mkdir python-hello
cd python-hello
Tasks
Open this folder in a text editor. Create a plain-text file named exactly:
hello.py
hello.py
Make sure it did not become hello.py.txt.
3. Write your greeting
Python displays text with print(). For example:
print("Good morning")
print("Good morning")
Tasks
Adapt that pattern so your file prints this clear greeting:
Hello, world!
Hello, world!
Save the file.
Tasks
4. Run the program
Return to the terminal. Use the Python command that worked earlier, followed by the filename. For example, if python3 worked:
python3 hello.py
python3 hello.py
Replace python3 with python or py if that was your working command.
Tasks
Milestone check
Your terminal should show:
Hello, world!
Hello, world!
It should return to the terminal prompt without an error.
If Python says it cannot find hello.py, run dir on Windows or ls on macOS/Linux. Confirm that hello.py appears and that the terminal is inside the python-hello folder.
Course Outline
1 module · 1 lesson
Create a Runnable Python App
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.