I have a tiny problem, because i want to check user password and force so that must using one special character. But in my output i get a invalid message even though password is created. How can i repair this thing?
special_character= '$#!'
created = False
while not created:
password = input('Type your password: ')
for char in special_character:
if char in password:
print('Password Created!!')
created = True
else:
print('Sorry, try again!')
Output:
Type your password: MyStronPassword123$
Password Created!!
Sorry, try again!
How can i discard this text: "Sorry try: again"
You should use an if statement to see if the password is created.
special_character= '$#!'
created = False
while not created:
password = input('Type your password: ')
for char in special_character:
if char in password:
print('Password Created!!')
created = True
if not created:
print('Sorry, try again!')
Output:
Type your password: MyStronPassword123$
Password Created!!