I just started python and some help would be greatly appreciated. I have 2 issues with execution. when I run the code as posted below, its not acknowledging that the parameters for the astrick being used it 5-25, then I removed the name inside of the parenthasies for the function, the code then accepted the parameters but would not generate the astrick.
import time, sys
def runZigzag(numOfAsterisk): indent = 0 indentIncreasing = True
try: while True: print(' ' * indent, end='') print('*' * numOfAsterisk) time.sleep(0.1)
if indentIncreasing:
indent = indent + 1
if indent == 20:
indentIncreasing = False
else:
indent = indent - 1
if indent == 0:
indentIncreasing = True
except KeyboardInterrupt:
Sys.exit()
while True:
try:
numOfAsterisk = int(input('Enter an integer between 5 and 25\n'))
except ValueError:
print('You must enter an integer\n')
except:
if: 4 <= numOfAsterisk:
print('The entered number is too low\n')
if 26 >= numOfAsterisk:
print('The entered number is too high')
else:
runZigzag(numOfAsterisk)
Aucun commentaire:
Enregistrer un commentaire