user presses ctrl- while python program is runningpython raises the keyboardinterrupt exception if there is no tryexcept statement to catch this exceptionthe program crashes with an ugly error message howeverfor our programwe want it to cleanly handle the keyboardinterrupt exception by calling sys exit((the code for this is in the except statement at the end of the program the while trueinfinite loop will repeat the instructions in our program forever this involves using indent to print the correct amount of spaces of indentation we don' want to automatically print newline after these spacesso we also pass end='to the first print(call second print(call prints the band of asterisks the time sleep(function hasn' been covered yetbut suffice it to say that it introduces one-tenth-second pause in our program at this point if indentincreasingincrease the number of spacesindent indent if indent = indentincreasing false change direction nextwe want to adjust the amount of indentation for the next time we print asterisks if indentincreasing is truethen we want to add one to indent but once indent reaches we want the indentation to decrease elsedecrease the number of spacesindent indent if indent = indentincreasing true change direction meanwhileif indentincreasing was falsewe want to subtract one from indent once indent reaches we want the indentation to increase once again either waythe program execution will jump back to the start of the main program loop to print the asterisks again except keyboardinterruptsys exit(if the user presses ctrl- at any point that the program execution is in the try blockthe keyboardinterrrupt exception is raised and handled by this except statement the program execution moves inside the except blockwhich runs sys exit(and quits the program this wayeven though the main program loop is an infinite loopthe user has way to shut down the program