Python is the most popular programming language for analytics, data science, and AI in 2026 — and it's one of the easiest to read. In this chapter we'll set up Python on your machine, walk through variables and data types, and write a few small programs you can actually use. Even if you've never coded before, you'll have a working Python setup by the end.
Why Python in 2026?
Python's appeal is that it reads almost like English. Compare a sum-of-squares written in Python and in another language:
numbers = [1, 2, 3, 4, 5]total = sum(n * n for n in numbers)print(total) # 55
That's three lines. The same logic in Java is roughly 10. Beyond readability, Python earns its place because:
- Massive ecosystem. 400,000+ libraries on PyPI — from
pandasandscikit-learntofastapiandlangchain. - Top language for data & AI. Most ML papers ship reference code in Python. All major LLM SDKs are Python-first.
- Job market. Roughly 35% of analytics & ML roles in India list Python as a primary requirement.
Installing Python
Albero recommends installing the latest stable release of Python (3.12 or later). On Windows and macOS, the easiest path is the official installer at python.org. On Linux, your package manager already has it.
# macOS (with Homebrew)brew install python# Ubuntu / Debiansudo apt update && sudo apt install -y python3 python3-pip# Windows# Download the installer from python.org and tick "Add Python to PATH"
Verify the install:
python --version# Python 3.12.4pip --version# pip 24.0
Your first program
Create a new file called hello.py in any folder. Open it in VS Code (or any editor) and add a single line:
print("Hello, Albero!")
Save the file, then run it from your terminal:
python hello.py# Hello, Albero!
That's it — you've shipped a Python program. The print() function is built in; you don't need to import anything to use it.
Variables
A variable is a labelled box. You put a value in, and you can refer to that value by the label. Python uses an equals sign to assign:
name = "Aanya"age = 28salary_lpa = 12.4is_alumni = Trueprint(name, age, salary_lpa, is_alumni)# Aanya 28 12.4 True
Two things to notice:
- Python is dynamically typed — you don't write a type. The value's type is inferred when you assign.
- The conventional naming style is
snake_case— lowercase with underscores. ReserveCamelCasefor class names.
Built-in data types
You'll work with a small set of built-in types every day. Here are the five you must know cold:
# int — whole numbersroll_no = 42# float — decimal numbersprice = 199.99# str — textcity = "Noida"# bool — True / Falseis_passing = True# NoneType — absence of valuereferral_code = Noneprint(type(roll_no), type(price), type(city), type(is_passing), type(referral_code))
The output:
<class 'int'> <class 'float'> <class 'str'> <class 'bool'> <class 'NoneType'>
Quick conversions
You'll often need to switch between types — for example, when reading user input (which always arrives as a string).
age_text = "28"age_num = int(age_text) # str -> intpercent = float("87.5") # str -> floatlabel = str(2026) # int -> strflag = bool(0) # 0 -> False, anything else -> Trueprint(age_num + 2, percent, label, flag)# 30 87.5 2026 False
Reading input · printing output
The input() function pauses the program and waits for the user to type something. Whatever they type comes back as a string.
name = input("What's your name? ")print(f"Welcome to Albero, {name} 🌱")
The f"..." syntax is an f-string — Python's built-in way to plug variables into a string. They're the cleanest way to format output, and you'll see them everywhere.
Comments & docstrings
Comments are notes for humans. Python ignores them at runtime.
# A single-line comment"""A multi-line string used as a comment block.Often used at the top of a file or function (called a docstring)."""def gst(amount, rate=0.18):"""Return amount inclusive of GST."""return amount * (1 + rate)print(gst(100)) # 118.0
Practice exercises
Try these in a fresh file. Solutions are intentionally not included — figure them out, then move to the next chapter.
- Ask the user for two numbers. Print their sum, difference, product, and quotient using f-strings.
- Read a temperature in Celsius and print it in Fahrenheit. Round to 2 decimals.
- Build a "tip calculator" — ask for the bill amount and tip percent, print the total.
- Bonus: print a friendly error message if the user types something that can't be converted to a number.
Key takeaways
- 01Python reads like English — it's the most popular language for analytics, ML and AI in 2026.
- 02Variables are dynamically typed — assign with =, name them in snake_case.
- 03The five built-in types you'll use daily are int, float, str, bool, and NoneType.
- 04Use input() to read text from the user and f-strings to format output cleanly.
- 05Comments and docstrings live for the future reader — write them generously.
