Where is a bug ? Help me please

Task: Write a program that takes in a string as input and evaluates it as a valid password. The password is valid if it has at a minimum 2 numbers, 2 of the following special characters ('!', '@', '#', '$', '%', '&', '*'), and a length of at least 7 characters. If the password passes the check, output 'Strong', else output 'Weak'. https://code.sololearn.com/cosSgFQIwQuT/?ref=app

4/5/2020 2:53:23 AM

Aldi Rasta Adrian

2 Answers

New Answer


You can also find by this way: password=input() password=list(password) numcount,symcount=0,0 for i in password: if i in '!@#$%&*': symcount+=1 if i.isdigit(): numcount+=1 if symcount>=2 and numcount>=2 and len(password)>=7: print('Strong') else: print('Weak')


okey , thank u for solution. i think my algorithm is bad