#Try Jupyter with Python. Start a new notebook, and copy/paste into a Jupyter kernel. Hit 'Run'. Enjoy! https://jupyter.org/try
import time
from IPython.display import Markdown, display
from IPython.display import clear_output
def printmd(string):
    display(Markdown(string))
def wait(): 
    time.sleep(1.25 - val * 0.25)
val = 1
while True: 
    
        print("where is my")
        wait()
        print("                                mind?")
        wait()
        
        if val == 1:
            phr = "she drifted off again,"
        else: 
            phr = "i drifted off again,"
        wrds = phr.split(" ")
        phrstr = ""
        z = 0
        for wrd in wrds: 
            phrstr = phrstr + " " * z**2 + wrd
            print(phrstr, end="\r")
            time.sleep(0.5 + z * 0.5)
            z = z + 1
        wait()
        
        printmd("*again,*")
        wait()
        printmd("**again,**")
        wait()
        
        for x in range (0,5):  
            string = "loading" + "." * x
            print (string, end="\r")
            time.sleep(1)  
        if val == 1: 
            print("ok, she's back. hello.")
        elif val == 2: 
            print("ok, i'm back. hello.")
        elif val == 3:
            print("thoughts moving too fast.")
        elif val == 4:
            print("will this ever stop?")
        elif val == 5:
            printmd("*overloading.*")
        wait()
        
        phrase = "it takes me time to get words out."
        words = phrase.split(" ")
        phrasestr = ""
        i = 0        
        for word in words: 
            if i == 0: 
                phrasestr = phrasestr + word
            else:
                phrasestr = phrasestr + " " + word
            print(phrasestr, end="\r")
            time.sleep(2 + i * -0.2)
            i = i + 1
        wait()
        
        pmphr = ["\n" + "once they get started,", "                         they come in torrents,", 
                "                                                  they come in waves,", 
                "like spring                       showers,        like summer rain", 
                "              come may flowers", "              endings and beginnings", 
                "*all good things*", "              end of the beginning?",
                "                                                  rain drops", "*drop tops*", 
                "              we came from nothin' to somethin'", "and back", "**again.**"]
        for phr in pmphr: 
            if phr == pmphr[6] or phr == pmphr[9]: 
                printmd(phr)
                wait()
            elif phr == pmphr[12]: 
                printmd(phr)
            else: 
                print(phr)
                wait()
        
        time.sleep(0.25)
        clear_output()
         
        val = val + 1