Python Lesson 3: Your First Python Program
You have Python installed. Now write real code. The tradition in programming is to start with “Hello, World!” — a simple program that proves everything works.
The Hello World Program
print("Hello, World!")
One line. Run it and see Hello, World! on your screen. That is your first program.
Understanding print()
print() is a function — a command that tells Python to display text on screen.
print("Hello!") # Hello!
print("I am learning Python") # I am learning Python
print(42) # 42
print(3.14) # 3.14
print("Text", "more text") # Text more text
Comments — Notes for Humans
Lines starting with # are comments. Python ignores them. Use them to explain your code.
# This is a comment — Python ignores this
print("This runs") # comment can go after code
# Always write comments for your future self!
# What does this code do and why?
Errors Are Normal
Every programmer sees errors every day. Do not fear them — errors are Python telling you exactly what to fix.
# Wrong — missing closing quote
print("Hello)
# SyntaxError: EOL while scanning string literal
# Correct
print("Hello") # always close quotes
🏋️ Practice Task
Write a program with 3 print() statements: (1) your full name, (2) what you do, (3) why you want to learn Python. Add a comment above each line explaining what it prints.
💡 Hint: Each print() goes on its own line. Comments start with #. Run with F5 in VS Code.