Write a program in python that accepts a string to setup a passwords. Your entered password must meet the following requirements:
* The password must be at least eight characters long.
* It must contain at least one uppercase letter.
* It must contain at least one lowercase letter.
* It must contain at least one numeric digit.
Your program should should perform this validation.
Source Code
length = lower = upper = digit = False
password = input('Enter the password: ')
if len(password)>= 8:
length = True
for letter in password:
if letter.islower():
lower = True
elif letter.isupper():
upper = True
elif letter.isdigit():
digit = True
if length and lower and upper and digit:
print('That is a valid password.')
else:
print('That password is not valid.')
Output
Enter your password: snake
That password is not valid.
Enter your password: kangaroo
That password is not valid.
Enter your password: Cat20
That password is not valid.
Enter your password: Elephant6
That is a valid password.