title: Automate The Boring Stuff Chapter 3: Zig-Zag exercise
body: <p>I am having a hard time figuring out why my code does not work as it is supposed to.
  Instead of a proper zig-zag, my output looks like a bunch of asterisks not doing anything.</p>
  <pre class="lang-py prettyprint-override"><code>import time, sys
  
  indent = 0 # How many spaces to indent.
  indentIncreasing = True #Whether or not the indent increases
  
  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:
              indentIncreasing = False
         # Change direction:
          else:
              #decrease the number of spaces:
              indent = indent - 1
              if indent == 0:
                  #Change direction:
                  indentIncreasing = True
  except KeyboardInterrupt:
      sys.exit() 
  </code></pre>
  <p>My output:
  <img src="https://i.stack.imgur.com/BBVd0.png" alt="enter image description here" /></p>
  <p>Desired output:
  <img src="https://i.stack.imgur.com/NLYhY.png" alt="enter image description here" /></p>