here's my code
import string
import random
len1 = input("Enter the length of the password you need\n")
ch1 = input("Enter the type\nUpper + Lower ---> 1\nAll Combined ---> 2\n")
if ch1 == '1':
chars = string.ascii_letters
x = ''.join(random.choice(chars) for i in range(len1))
print("Generated Password Based Upon Your Request Is '{0}'".format(x))
elif ch1 == '2':
for i in range(5):
chars = string.ascii_uppercase + string.ascii_lowercase
ide = chars + string.digits
y = ''.join(random.choice(ide) for i in range(len1))
print("The Generated Password Based Upon Your Request Is '{0}'".format(y))
print("-----------------")
print("If Not Generated, You Can Repeat the Process Again Upto {0} times".format(4-i))
print("-----------------")
rec = input("Want 2 Repeat?? Press 1; Else 2\n")
if rec == 1:
continue
else:
break
I am getting x = ''.join(random.choice(chars) for i in range(len1)) TypeError: 'str' object cannot be interpreted as an integer. Pls fix my code and tell me the error.