Skip to content

Operadores#

Los operadores se usan para realizar operaciones con valores.

Operadores Aritm茅ticos#

a = 5
b = 2

suma = a + b          # Suma: 7
resta = a - b         # Resta: 3
multiplicacion = a * b  # Multiplicaci贸n: 10
division = a / b      # Divisi贸n: 2.5
modulo = a % b        # M贸dulo: 1
potencia = a ** b     # Exponente: 25

Operadores Comparativos#

x = 10
y = 20

igual = x == y         # Igual: False
diferente = x != y     # Diferente: True
mayor = x > y          # Mayor: False
menor = x < y          # Menor: True
mayor_o_igual = x >= y # Mayor o igual: False
menor_o_igual = x <= y # Menor o igual: True

Operadores L贸gicos#

a = True
b = False

and_op = a and b      # and: False
or_op = a or b        # or: True
not_op = not a        # not: False