Hello, world! Your first script
Programming in Python usually happens in text files with the .py extension. When you run such a file, the Python interpreter reads it top to bottom, executing each statement. Let us create your first file and make the computer speak.
Create and run
Your first workflow ▶
📝
Write
Create hello.py
→
💾
Save
Write the code and save
→
🐚
Terminal
Open the console in that folder
→
🚀
Run
python3 hello.py
Walking through the code
What is inside hello.py? ▼
python
1
print('Hello, World!')▼
2
# This is my first comment
▼
What makes up a statement?
Parts of a print() call
🧠
Function
()
Parentheses ()
''
Quotes '' or ""
File vs output
Code vs what the user sees
📄Script
| id | name |
|---|---|
| 1 | print('Python is cool') |
📄Terminal
| id | name | status |
|---|---|---|
| 101 | Python is cool | Success |
What the programmer sees in the editor.
ℹ️In Python it does not matter whether you use single or double quotes for text, as long as the opening and closing quotes match. print("Hello") and print('Hello') behave the same.