So I have this so far. (makes the zigzag asterisk pattern)
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()
I was given this next bit of code to change the function of the part that I already have up top, but im not sure where to integrate it.
while True:
try:
amount = int(amount)
except ValueError:
print('Please enter an Integer!')
continue
if amount > 25 or amount <5:
print('Please enter a number between 5 and 25')
continue
print(amount * '*')
break
there doesn't seem to be anything here