Added check to ensure length is an integer

This commit is contained in:
Andrew Scott 2021-12-15 21:05:42 -05:00
parent 0b58ce08c9
commit 855a6bb633

View file

@ -92,7 +92,14 @@ def main():
print('Note that ambiguous characters such as 0 (zero) and O (capital o) \ print('Note that ambiguous characters such as 0 (zero) and O (capital o) \
are automatically excluded!\n') are automatically excluded!\n')
length = ''
while length is not int:
try:
length = int(input('How many characters for your password? ')) length = int(input('How many characters for your password? '))
break
except ValueError:
print('Please enter an integer.')
use_uchars = input('Use uppercase? [Y/n] ') use_uchars = input('Use uppercase? [Y/n] ')
use_nums = input('Use numbers? [Y/n] ') use_nums = input('Use numbers? [Y/n] ')
use_symbols = input('Use symbols? [Y/n] ') use_symbols = input('Use symbols? [Y/n] ')