Answer:
passwords = ["123456", "123456789", "qwerty", "password", "111111", "12345678", "abc123", "1234567", "password1", "12345"]
used_passwords = []
while True:
password = input("Choose a password: ")
if password in passwords:
print("You must not choose a common password!")
continue
elif password in used_passwords:
print("You used this password before. Choose a new one.")
continue
else:
used_passwords.append(password)
break
Step-by-step explanation:
*The code is in Python.
Initialize the passwords array with 10 most common user-selected passwords
Initialize the used_passwords array as empty
Create an infinite while loop. Inside the loop, ask the user to choose a password. Check if entered password is in the passwords or not. If it is, print a warning and ask the user to choose again using continue statement. If the entered password is in the used_passwords, print a warning message and ask the user to choose again using continue statement. If the previous conditions are not satisfied, it means the password is valid. Add the password to the used_passwords array and stop the loop using break statement.