Skip to main content

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

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, an = 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:
TypeKeywordExample valueWhat it represents
Integerint908Whole numbers (no decimal point)
Floatfloat10.1Numbers with a decimal point
Stringstr"Mario"Text, wrapped in quotes
BooleanboolTrueA 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
import os
os.system('cls')

#Una variable es algo o un valor que puede cambiar en el tiempo
valora = 908
#Imprime lo que esta en el parentesis
print(valora)
#los lenguajes tipados requieren saber que tipo de datos es
valora = 908 #cualquier numero
decimales = 10.1 #Cualquier numero con decimales
nombre = "Mario" #Cualquier texto
confirmacion = True #Tipos booleans False o True
print( valora)
print( decimales)
print( nombre )
print( confirmacion)
Notice that 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.
In statically typed languages the same four variables would need explicit type annotations:
Statically typed equivalent (not valid Python)
#Variables tipados
#int valora = 908 #cualquier numero
#double decimales = 10.1 #Cualquier numero con decimales
#string nombre = "Mario" #Cualquier texto
#boolean confirmacion = True #Tipos booleans False o True
In Python you simply write the value and let the interpreter handle the rest — no int, double, string, or boolean keywords needed before the variable name.

Checking Your Python Version

The course uses sys.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
#Importar una libreria de systema
import sys

#Print sirve para imprimir informacion
print(sys.version[0])
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.
valora = 908
print(type(valora))  # <class 'int'>

float — Floating Point

Numbers that include a decimal point.
decimales = 10.1
print(type(decimales))  # <class 'float'>

str — String

Text wrapped in single or double quotes.
nombre = "Mario"
print(type(nombre))  # <class 'str'>

bool — Boolean

Logical truth values: True or False.
confirmacion = True
print(type(confirmacion))  # <class 'bool'>

Build docs developers (and LLMs) love