Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Challenge 3
- #Can you make a function which generates a random password of any length? #
- #the function should accept one parameter, the desired password length, and return a password.#
- #You may find it useful to import the choice function from the random module.
- import random
- length=int(input(" how long do you want the pasword to be?"))
- def password_generator(length):
- letters ='abcdefghijklmnopqrstuvwxyz123456789ABCDEFGHIJKLMNOPQRSTU'
- password =""
- for i in range (length):
- password =random.choice(letters)
- print (password, end ='')
- password_generator(length)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement