0

Bugged-up Pass Gen

I have a password generator that I am working on. There are two ways to generate the passwords but I want the user to decide which way they want to. Both of the ways work perfectly, but choosing it doesn’t work. It’s always giving me an error about not defining something. Here is my code below: import random passType = input(“What type of password would you like? Types are random characters, and then there are passwords that you can easily remember. Type either ‘pass1’ or ‘pass2’”) if passType == pass1: characters = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890” def password(arr, passlen=12): random = arr[randoms(0, len(arr))] count = passlen password = “” for i in range(count): password = password + random random = arr[randoms(0, len(arr))] return password def randoms(min, max): return random.randint(min, max) print(password(characters)) elif passType == pass2: name = input(“What is your first name?”) Lname = input(“What is the first letter of your last name?”) numbers = input(“Type in the string of numbers of your birth day, month, and year. ( no slashes or spaces, just numbers )”) print(name+Lname+numbers)

20th Dec 2018, 8:14 PM
PhantomWare
PhantomWare  - avatar
2 Antworten
+ 2
you say that something is not defined, this would have to be in you're if statements. you say pass1 but you should have it as 'pass1' because pass1 will be treated as a variable but you have never defined it
20th Dec 2018, 8:54 PM
Julian
Julian - avatar
+ 1
Yeah thanks. I literally just found that out right before i read your comment.
23rd Dec 2018, 4:06 PM
PhantomWare
PhantomWare  - avatar