¡Feliz Navidad!

import os
import time
import random

WIDTH = 40
HEIGHT = 20
TREE_POS = WIDTH // 2

def clear():
    os.system("cls" if os.name == "nt" else "clear")

def draw_frame(snow):
    clear()
    for y in range(HEIGHT):
        line = [" "] * WIDTH

        # Árbol
        if y > 3 and y < HEIGHT - 3:
            tree_width = y - 3
            for x in range(TREE_POS - tree_width, TREE_POS + tree_width + 1):
                if 0 <= x < WIDTH:
                    line[x] = "🎄"

        # Tronco
        if y >= HEIGHT - 3:
            for x in range(TREE_POS - 1, TREE_POS + 2):
                line[x] = "🪵"

        # Nieve
        for (sx, sy) in snow:
            if sy == y:
                line[sx] = "❄️"

        print("".join(line))

    print("\n✨ Feliz Navidad y felices commits ✨")

def update_snow(snow):
    new_snow = []
    for (x, y) in snow:
        if y + 1 < HEIGHT:
            new_snow.append((x, y + 1))
    if random.random() < 0.5:
        new_snow.append((random.randint(0, WIDTH - 1), 0))
    return new_snow

snowflakes = []

while True:
    snowflakes = update_snow(snowflakes)
    draw_frame(snowflakes)
    time.sleep(0.3)

Ho ho ho! 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024...

Comentarios