In Python, a variable is something — or a value — that can change over time (“Una variable es algo o un valor que puede cambiar en el tiempo”). Think of a variable as a labelled box: you give the box a name, put a value inside it, and you can swap that value out whenever you need to. No setup ceremony required — just write a name, anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/marioaje/Python/llms.txt
Use this file to discover all available pages before exploring further.
= sign, and the value you want to store.
The Four Core Data Types
Python has four primitive data types you will use in almost every program you write. The table below maps each type to its Python keyword and shows the exact examples used in the course:| Type | Keyword | Example value | What it represents |
|---|---|---|---|
| Integer | int | 908 | Whole numbers (no decimal point) |
| Float | float | 10.1 | Numbers with a decimal point |
| String | str | "Mario" | Text, wrapped in quotes |
| Boolean | bool | True | A truth value: True or False |
Variables in Action
The snippet below is the first program from the course. It declares one variable of each type and prints them to the console:semana1/variables.py
valora starts as 908, is printed once, and then is simply reassigned to 908 again — demonstrating that a variable’s value can be replaced at any point during execution.
Python Is Dynamically Typed
Python is a dynamically typed language. You never have to declare the type of a variable before using it — Python figures out the type automatically from the value you assign. This is different from statically typed languages like Java or C++, where you must declare the type upfront.
Statically typed equivalent (not valid Python)
int, double, string, or boolean keywords needed before the variable name.
Checking Your Python Version
The course usessys.version to inspect which major version of Python is running. This is a handy one-liner to add to any project’s entry point:
semana1/informacion.py
sys.version returns the full version string (e.g. "3.11.4 (default, ...)") and [0] slices just the first character — the major version number — so you get 3 printed to the console.
Quick Reference
int — Integer
Whole numbers, positive or negative, with no decimal point.
float — Floating Point
Numbers that include a decimal point.
str — String
Text wrapped in single or double quotes.
bool — Boolean
Logical truth values:
True or False.