May-03-2020, 02:09 AM
windows 10, python 3.8
Trying to do zigzag example but not getting right result. I type following code, which I think is identical to the lesson's:
Trying to do zigzag example but not getting right result. I type following code, which I think is identical to the lesson's:
import time, sys indent = 0 # How many spaces to indent. indentIncreasing = True #Whether the indentation is increasing or not. try: while True: #The main program loop print('' * indent, end='') print('********') time.sleep(0.1) #Pause for 1/10 of a second. if indentIncreasing: #Increase the number of spaces: indent = indent + 1 if indent == 20: #Change direction: indentIncreasing = False else: #Decrease the number of spaces: indent = indent - 1 if indent == 0: #Change direction: indentIncreasing = True except KeyboardInterrupt: sys.exit()But instead of getting a looping result like this:
******** ******** ******** ******** ******** ******** ******** ******** ********...I am instead getting a looping result like this:
******** ******** ******** ******** ******** ******** ******** ******** ********