Skip to main content
Albero Academy

Python Fundamentals

Learn the basics of Python — installation, variables, data types, input/output, comments, and your first programs.

Chapter 1Python11 min readBeginner friendly
  • #Python
  • #Basics
  • #Variables

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:

python · readable
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 pandas and scikit-learn tofastapi and langchain.
  • 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.

terminal
# macOS (with Homebrew)
brew install python
# Ubuntu / Debian
sudo 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:

terminal
python --version
# Python 3.12.4
pip --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:

hello.py
print("Hello, Albero!")

Save the file, then run it from your terminal:

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:

Python
name = "Aanya"
age = 28
salary_lpa = 12.4
is_alumni = True
print(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. Reserve CamelCase for 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:

Python
# int — whole numbers
roll_no = 42
# float — decimal numbers
price = 199.99
# str — text
city = "Noida"
# bool — True / False
is_passing = True
# NoneType — absence of value
referral_code = None
print(type(roll_no), type(price), type(city), type(is_passing), type(referral_code))

The output:

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).

Python
age_text = "28"
age_num = int(age_text) # str -> int
percent = float("87.5") # str -> float
label = str(2026) # int -> str
flag = bool(0) # 0 -> False, anything else -> True
print(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.

greet.py
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.

Python
# 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

  1. 01Python reads like English — it's the most popular language for analytics, ML and AI in 2026.
  2. 02Variables are dynamically typed — assign with =, name them in snake_case.
  3. 03The five built-in types you'll use daily are int, float, str, bool, and NoneType.
  4. 04Use input() to read text from the user and f-strings to format output cleanly.
  5. 05Comments and docstrings live for the future reader — write them generously.