Question: I'm trying to make a python program that makes a randomized password generator. The password has to have at least 9 characters which starts with

I'm trying to make a python program that makes a randomized password generator. The password has to have at least 9 characters which starts with a upper case, ends with a integer between 0 and 9, have one special character(second character), and the rest is filled with lower case. ex. Y!mebjivm7, O@eqdafkjig2. I was able to write most of the code but struggling to make multiple lower case letter to fill the requirements.

def main(): import random while True: size = int(input("Enter the size of your password: ")) try: if size < 9: print("The password should be at least 9 characters. Try again!") continue except ValueError: print("The size should be a number. Try again!") continue first_letter = chr(random.randint(65,90)) special_char = random.choice('!@#$') last_letter = str(random.randint(0,9)) lower = [] for letter in range(size-3): lower.append(random.randint(97,122) password = first_letter + special_char + lower + last_letter

print("Suggested password: ", password) choice = input("Are you satisfied with your password (yes/no)? ") if choice[0] == 'y': break print("Great@ this password is random enough!") main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!