Some guru help me with the decrypting tool Python 3 code
I have written a simple password generator (MODULE 1) and wanted to add a decrypting tool(MODULE 2). MODULE 1 works just fine (feel free to point out and possible optimizing, though), I have trouble with MODULE 2, I cannot locate the bug. # PROJECT 9 ENCRYPTOR and DECRYPTOR # MODULE 1: password generator from random import randint while True: try: digit = int(input('please enter the digit of numberic password= ')) except: print('please enter numberic input') pw = '0' i = 2 while i <= digit: pw_tmp = randint(0, 9) i += 1 pw = pw + str(pw_tmp) print(pw) # MODULE 2: password cracker pw = '012345' digit = len(pw) pw_crack = '0' p = 0 count = 0 while p <= digit - 1: q = 0 while q <= 9: count += 1 if str(q) == pw[p]: pw_crack = pw_crack + str(q) continue else: q += 1 p += 1 print(pw_crack) print(count)