Curso Completo De Python Programacion En Python Desde Cero 📥

set1 = {1, 2, 3} set1.add(4) set1.discard(2) Definir y llamar

for i in range(10): if i == 3: continue # salta el 3 if i == 7: break # termina el bucle print(i) Listas (mutables, ordenadas) curso completo de python programacion en python desde cero

# Modos: 'r' lectura, 'w' escritura (sobrescribe), 'a' añadir with open("datos.txt", "r", encoding="utf-8") as archivo: contenido = archivo.read() print(contenido) # leer línea por línea for linea in archivo: print(linea.strip()) set1 = {1, 2, 3} set1

with open("salida.txt", "w") as f: f.write("Línea 1\n") f.write("Línea 2\n") Clases y objetos set1 = {1

if True: print("Estoy indentado") # Obligatorio: 4 espacios