Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Python
choice=("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z")
choice1=("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z")
choice2=("0,1,2,3,4,5,6,7,8,9")
user=input("Enter password")
while not (6 <= len(user) <= 12):
    user=input("The password needs to be at least 6 characters and no more than 12, enter password again")
if user in (choice2) or user in str(choice) or user in  (choice1):
    print("password is weak")
elif user in  choice2 and  choice1 or user in choice and choice1 or user in choice and choice2:
    print("your password is medium")
elif user in choice2 and  choice1 and  choice:
    print("your password is strong")

when i run this it doesnt tell the user if their password is strong, medium or weak:
Python
Enter passwordlllllll
>>> 
Posted
Comments
Richard MacCutchan 12-Dec-15 14:37pm    
You need to compare individual letters of the password. Your if statements are looking for the string "111111" in your choice fields; do you see it anywhere?
kesh123 12-Dec-15 17:36pm    
how do i do that?
Richard MacCutchan 13-Dec-15 3:02am    
Count the number of characters that are repeated. See https://docs.python.org/3.3/library/stdtypes.html#index-31 for all the String methods and operations.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900