# Aritméticos: + - * / // % ** print(10 / 3) # 3.333... print(10 // 3) # 3 (división entera) print(10 % 3) # 1 (resto) print(2 ** 3) # 8 (potencia) Lógicos: and or not 5. Estructuras de Control Condicionales (if/elif/else)
# Sobre rango for i in range(5): # 0,1,2,3,4 print(i) for i in range(2, 10, 2): # inicio, fin, paso -> 2,4,6,8 print(i) for letra in "Python": print(letra) curso completo de python programacion en python desde cero
nombre = input("¿Cómo te llamas? ") print("Hola", nombre) print(f"Encantado, {nombre}") # f-string (recomendado) Tipos básicos # Aritméticos: + - * / // % ** print(10 / 3) # 3
def suma_todos(*args): # tupla return sum(args) def mostrar_info(**kwargs): # diccionario for k, v in kwargs.items(): print(f"{k}: {v}") 4 print(i) for i in range(2
# Esto es un comentario print("Hola") # Comentario en lÃnea
edad = 18 if edad < 18: print("Menor") elif edad == 18: print("Justo mayor") else: print("Mayor")