Ch1. Python Introduction
What is Python?
Imagine that if programming languages were a group of people, Python would be the friend who speaks most concisely and is easiest to get along with. It was created by Dutch programmer Guido van Rossum in 1991, named after the British comedy troupe Monty Python (not the snake 🐍, though its logo does feature two snakes).
Python's core philosophy can be summarized in one phrase: "Life is short, you need Python."
Why Learn Python?
- Beginner-friendly — Syntax is close to natural language, no curly braces
{}; uses indentation instead, code reads like English prose - Widely used — From websites to AI, from data analysis to automation scripts, Python is everywhere
- Huge community — Got a question? There are hundreds of thousands of Python Q&As on Stack Overflow
- Great job prospects — Python developer demand consistently ranks in the top 3 of programming language charts
- Competitive salaries — Average monthly salary for Python developers is 15K-35K+, even higher for AI roles
Python Application Domains
| Domain | Typical Applications | Notable Cases |
|---|---|---|
| 🌐 Web Development | Website backends, API services | Instagram, Pinterest, Spotify |
| 🤖 Artificial Intelligence | Machine learning, deep learning, NLP | ChatGPT training frameworks, AlphaGo |
| 📊 Data Analysis | Data cleaning, visualization, BI | Netflix recommendation system |
| 🔧 Automation | Office automation, DevOps scripts, web scraping | Batch Excel processing, automated testing |
| 🎮 Game Development | Game scripting, indie games | Civilization 4, Battlefield 2 scripts |
| 📱 Embedded | IoT, Raspberry Pi development | Smart home control |
Version Choice: Python 2 or Python 3?
The answer is simple: Choose Python 3!
Python 2 officially stopped maintenance on January 1, 2020. All new projects should use Python 3. The latest stable version is Python 3.12+, and all code in this guide is written based on Python 3.10+ syntax.
💡 Tip: 💡 Quick tip: Type
python3 --versionin your terminal to check the currently installed Python 3 version. If your system comes with Python 2, remember to use thepython3command instead ofpython.