Write a Python program that creates passwords. Ask the user to input their name.
ID: 3833677 • Letter: W
Question
Write a Python program that creates passwords. Ask the user to input their name. You will create two passwords for the user: one simply and one complex. The simple password will consist of the first three letters of the last name followed by the first three letters of the first name and then a random number from zero through nine. The complex password will consist of five random puncuation symbols.
You must create two dictionaries to store the passwords - one for the simple passwords and one for the complex passwords.
Set up a loop to create three passwords for three users and then print out both dictionaries.
Pls help, Thank you!
Explanation / Answer
import random
lt = ["","",""]
ex = [''',':',',','-','!','(',')','.','?','"',';']
d = {}
for i in range(0,3):
lt[i] = raw_input("Enter the name for user "+str(i+1)+":")
s = lt[i]
s = s.split(" ")
ft = s[0]
lst = s[1][-3:]
ft = s[0][:3]
d[i] = [lst+ft]
random.shuffle(ex)
d[i].append("".join(ex[0:5]))
print(d)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.