What is Python? β Why is it so popular?
After completing this topic
You will be able to explain what Python is and why it is used in so many fields.
The most popular language in the world
In the rankings of programming language popularity (TIOBE, Stack Overflow survey), Python consistently ranks 1st or 2nd every year. From introductory courses at universities to data analysis, AI research, web servers, and automation scripts, Python is everywhere.
Why is that?
Easy to read
The biggest advantage of Python is that the code is easy to read, like English.
# Another language (Java)if (score >= 90) { System.out.println("A grade");}
# Pythonif score >= 90: print("A grade")It uses indentation to separate blocks of code, without curly braces ({}). There are no semicolons (;) either. Even beginners can immediately understand "what this means."
Interpreted language
Python is an interpreted language. You can execute the code line by line.
# Enter the interactive mode by typing python3 in the terminal>>> 2 + 35>>> "hello" * 3'hellohellohello'>>> len("Python")6Since compilation (converting source code β executable file) is not required, you can immediately check the results as you write. It is ideal for experimenting and learning.
Dynamic typing
You do not declare the type when creating a variable.
# Use it directly without type declarationname = "Kim Hoon" # Stringage = 30 # Integerpi = 3.14 # Floatis_student = True # Boolean
# You can also put a different type in the same variablex = 10x = "Now a string" # No errorIt is flexible, but in large programs, it can be difficult to keep track of "what is in this variable." Therefore, type hints were introduced in Python 3.5 (not enforced).
Library ecosystem
The reason Python is so powerful is its libraries.
| Field | Representative Library |
|---|---|
| Data analysis | pandas, numpy |
| Visualization | matplotlib, seaborn |
| Machine learning | scikit-learn, PyTorch, TensorFlow |
| Web server | Django, Flask, FastAPI |
| Automation | selenium, requests, BeautifulSoup |
| Bioinformatics | BioPython, scanpy |
"I want to do this" β pip install library_name β use it immediately. Tasks that would take hundreds of lines in other languages can be done in a few lines in Python.
# Example: Fetching a web pageimport requestsresponse = requests.get("https://example.com")print(response.status_code) # 200Weaknesses of Python
It is not all-powerful:
| Weakness | Reason |
|---|---|
| Speed | As an interpreted language, it is 10-100 times slower than C/C++ |
| Mobile app | Not suitable for iOS/Android app development |
| Browser | Web front-end is the domain of JavaScript |
For speed-critical operations, libraries written in C (numpy, PyTorch) handle the processing. It has a structure where "Python directs, and C executes."
Where to start
# Check if it is installedpython3 --version
# Start interactive modepython3
# Run from a filepython3 hello.pyIt is likely already installed (macOS, Linux). On Windows, download it from python.org.