Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 905 Bytes

zigzag.org

File metadata and controls

32 lines (24 loc) · 905 Bytes

Zigzag

This script originally came from automatetheboringstuff.com by Al Sweigart. Some students found the colorama module so we are going to use this script to explore how to change colors in the terminal output and modify the print function.

import time
from rich import print

indent = 0
indent_increasing = True

while True:
    print(" " * indent, end=" ")
    print(f"[red on white]*********\n\n")
    time.sleep(0.1)

    if indent_increasing:
        indent = indent + 1
        if indent == 15:
            indent_increasing = False

    else:
        indent = indent - 1
        if indent == 0:
            indent_increasing = True

Source Code