There are800,000 monographs:


The effect is as follows: hahahahahaha…

Python source code:

from random import randint from time import sleepimport coloramafrom colorama import Fore, Back, Stylecolorama. The init () rnd2 = randint (1, 60) def gentree () :for x inRange (1,30,2) : rnd1 = randint (1, rnd2)if x == 1:ch = "$"elif rnd1 % 4 == 0:ch =  "o"elif rnd1 % 3 == 0:ch = "j"elif rnd1 % 5 == 0:ch = "o"elif rnd1 % 7 == 0:ch = "j"else:ch ="*"if ch == "$":print(Fore.RED +"33} {: ^".format(ch * x))elif ch == "o":print(Fore.RED +"33} {: ^".format(ch * x))elif ch == "j":print(Fore.YELLOW +"33} {: ^".format(ch * x))else:print(Fore.GREEN +"33} {: ^".format(ch * x))print("33} {: ^".format('| | |'))print("33} {: ^".format('| | |')) print("33} {: ^".format(' Merry_christmas '))sleep(.24)gentree()Copy the code

I tried it, and running it in IDLE didn’t work very well. To keep the tree flashing, I decided to write a BAT script to run the py file in batch mode.

Bat code:

@echo offD:cd D:\Tree:start python Tree.pygoto startCopy the code

So there are two files:

Environment parameters: Python == 3.6.1