#random password generator
import random
unified_code = "awertyuiosqpdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&*()_+"
passlength1=input("how long should your password be")
pass_length2=input("how long should your password be")
def generatrandompaassword():
length = random.randint(passlength1,pass_length2 )
password = ""
for index in range(length):
randomCharacter = random.choice(unified_code)
password = password + randomCharacter
return password
passworder = generatrandompaassword()
print(passworder)
print("This is your new password")
this won't let me post for some reason what is a comment
this is the code iv made I started python a couple of days ago so I'm pretty new to it
fist I tried putting one-variable and than asking the user for the input and inserting the input into the program and using that to find the length of how long the password should be can get help with this?
Code - Your code needed minor changes
The input your receive from the user is of type
str
, so you need to convert it intoint
data type.Output
Suggestions:
_
or camelCasing.pass_length1
andrandomCharacter
are of two styles.generate_random_password
thangeneratrandompaassword
=
before and after.