Week 1: Python Basics & Setup
Getting Started with Python
What is Python?
Python is a high-level, general-purpose programming language known for its clean, readable syntax. It was created by Guido van Rossum and first released in 1991. Python emphasizes code readability and simplicity, making it one of the most popular languages for beginners and professionals alike.
Python is used in web development, data science, artificial intelligence, automation, scripting, and much more.
Installing Python
- Visit https://python.org/downloads
- Download the latest stable version (3.x).
- Run the installer. On Windows, check "Add Python to PATH" before clicking Install.
- Verify installation by opening a terminal and running:
python --version
Your First Python Program
Create a file named hello.py and write:
print("Hello, World!")
Run it from the terminal:
python hello.py
The print() function outputs text to the console. It's the most basic way to see output from your program.
Python vs Other Languages
| Feature | Python | JavaScript |
|---|---|---|
| Indentation | Required (enforced) | Optional (style only) |
| Semicolons | Not needed | Optional |
| Typing | Dynamic | Dynamic |
| Block delimiters | Indentation | Curly braces {} |
| File extension | .py |
.js |
Comments
Comments are lines Python ignores — they're for human readers.
# This is a single-line comment
"""
This is a
multi-line comment (docstring)
"""
print("Comments don't affect output")
The REPL (Interactive Shell)
Type python in your terminal to enter the interactive shell. You can run Python one line at a time — great for experimenting.
>>> 2 + 2
4
>>> print("Hello")
Hello
Type exit() to leave the REPL.