Python Introduction
Understand what Python is, how it runs your code, and why it is used in web, automation, data, and AI.
Python is a general-purpose programming language. “General-purpose” means you can build many types of software with it, not just one category. Python is famous for one thing: **readability**. A beginner can read Python code and understand what it is doing, and a professional team can still use it to build real products. ## What Python is (in simple terms) When you write Python, you write instructions in a `.py` file. When you run the file, the Python interpreter reads your code and executes it line by line. Python is an **interpreted** language in everyday usage (it runs through an interpreter), which makes it excellent for learning and for fast development. ## Why companies use Python Python is popular because it solves real problems efficiently: - **Web backends**: build APIs and server logic - **Automation**: scripts to rename files, scrape data, send emails - **Data and reporting**: dashboards, ETL, analytics - **AI and machine learning**: training models, building AI services - **Testing**: automation tests and tools ## How Python runs your code When you run a program, this is the mental model: 1) You write instructions 2) Python reads them in order 3) Python executes them and produces output ```mermaid flowchart LR A[Write code in .py] --> B[Run python file.py] B --> C[Python interpreter executes line by line] C --> D[Output / results] ``` ## Your first program (and what it means) ```python print("Hello, Python!") ``` - `print()` is a built-in function - It displays text on the screen Run: ```bash python hello.py ``` Expected output: ``` Hello, Python! ``` ## The 3 beginner tools you will use most - **Terminal**: to run Python files - **Editor (VS Code)**: to write code - **Browser**: to search docs and learn You do not need fancy setups at the beginning. You need a clean installation, consistent practice, and small projects. ## How to think like a programmer from day 1 A strong concept that helps you learn faster: - Programs are not magic - A program is a set of instructions - The computer follows instructions exactly - If your output is wrong, the instructions are wrong or incomplete ## Common confusion: Python vs Python packages Python is the language. Packages are add-ons (libraries) you install, like: - requests (for HTTP) - pandas (for data) - numpy (for math) You do not need packages to start learning. First, master core Python. ## Quick learning checklist By the end of the first 10 lessons, you should be able to: - run Python from terminal - use variables, strings, numbers - use lists and dictionaries - use if statements and loops - write functions to reuse logic In the next lesson, you will install Python correctly and verify the setup so your environment behaves consistently.