Codemas Tree

pip install numpy pip install colorama
 avatar
KazukiDelta
python
10 months ago
1.1 kB
10
Indexable
import os
import time
import numpy
import colorama
from colorama import Fore
from random import choice

while True:
    x = numpy.arange(7, 16)
    y = numpy.arange(1, 18, 2)
    z = numpy.column_stack((x[::-1], y))

    for idx, (i, j) in enumerate(z):
        if idx == 0:
            print(Fore.LIGHTYELLOW_EX, " " * (i - 2) + "*" * j)
        else:
            stra = " " * (i - 1) + "*" * j
            for char in stra:
                color = choice(
                    [
                        Fore.LIGHTBLUE_EX,
                        Fore.LIGHTCYAN_EX,
                        Fore.LIGHTGREEN_EX,
                        Fore.LIGHTMAGENTA_EX,
                        Fore.LIGHTRED_EX,
                        Fore.LIGHTYELLOW_EX,
                        Fore.LIGHTWHITE_EX
                    ]
                )
                print(color + char, end="")
            print()
                

    for r in range(2):
        print(Fore.YELLOW, " " * 10, " ||| ")

    
    time.sleep(0.1)
    print(colorama.Style.RESET_ALL)
    os.system("cls")
    
Editor is loading...
Leave a Comment