Chapter 1 of 12
Python is one of the world's most popular programming languages โ used in web development, AI, data science, automation, and scripting. Its design philosophy prioritises readability: Python code reads almost like English.
ANALOGY
Python is the Swiss army knife. JavaScript runs in browsers (its main domain). Python runs everywhere and does everything โ write a web server, train a machine learning model, automate file management, analyse a spreadsheet, build a chatbot. No other language has as many production use cases across as many different fields.
# This is a comment โ the # symbol starts a comment
print("Hello, World!")
# Variables โ no type declarations needed
name = "Nelson"
age = 26
pi = 3.14159
# Python infers the type from the value
print(name) # Nelson
print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>
# String formatting โ f-strings (the modern way)
print(f"Hello, {name}! You are {age} years old.")# Check version (need Python 3.8+)
python --version # or python3 --version
# Run a file
python my_script.py
# Interactive REPL
python
>>> print("Hello!")
>>> 2 + 2
4
>>> exit()
# VS Code: install the Python extension, then run with F5