jeudi 23 avril 2020

why is the for loop inside the if statement not executing? [duplicate]

Is the statement if how_many == int: not valid? The code after that block is not executing.

from random import randint

print('Code Generator')
print()

def generator():
    how_many = int(input('How many digits? '))
    print('Code is: ', end='')
    if how_many == int:
        for number in range(how_many):
        number = randint(0, 9)
        print(number, end=' ')
   else:
        print('Enter a number')
        generator()

   print()
   again = input('Again?(Y/N): ')
   if again.upper() == 'Y':
       generator()
   else:
       print('Goodbye!')
       exit()

generator()

Aucun commentaire:

Enregistrer un commentaire