0

Calling user input

So i have just coded the program below and I would like the user to input their password again using the password that they have inputed, how should I code? def password_check(passwd): if len(passwd) != 8: print('Length should be 8 words') return False if passwd.isalpha() == False: print('Password must not contain any numbers') if not any(char.isupper() for char in passwd): print('Password should have at least one uppercase letter') return False if not any(char.islower() for char in passwd): print('Password should have at least one lowercase letter') return False else: print("Valid Password") return True check = False while not check: check = password_check(input("Enter your password: "))

1st Oct 2020, 11:42 AM
Nayotama Pradipta
Nayotama Pradipta - avatar
2 Respostas
+ 3
Nayotama Pradipta , Just to make sure i understand you right ? - user inputs a password, that will be verified according some rules. - if password is valid according rules, you want the user to input the password again to validate the first input against the second input of password. if this is the case, ou should rework your function like this: - first function should only do the validation according rules - do a second function that will be called if first input is valid, take a second input and compare it against the first a procedure like that is normally only necessary by creating a new password. with a regular login password should only be compared against the password stored by your program.
1st Oct 2020, 2:23 PM
Lothar
Lothar - avatar
0
I don't understanding.. ! You can take 2 times input and compare.....! Is that not work?
1st Oct 2020, 11:55 AM
Jayakrishna 🇮🇳