Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. def communicat(sentence):
  2. finish_com = []
  3.  
  4. if not any(char.isdigit() for char in sentence):
  5. finish_com.append("Password must contain at least one number")
  6. if not any (char.isupper() for char in sentence):
  7. finish_com.append("Password must contain at least one upper character")
  8. if len(sentence)<5:
  9. finish_com.append("Minimum length of password must consist of 5 characters")
  10. #print(finish_com)
  11. komunikaty = "\n".join(finish_com)
  12. #print(komunikaty)
  13. return komunikaty
  14.  
  15.  
  16.  
  17.  
  18. suma = 1
  19. while True:
  20.  
  21. haslo = input("Please write your password: ")
  22.  
  23. if any(char.isdigit() for char in haslo) and any(char.isupper() for char in haslo) and len(haslo) >= 5:
  24. print("Password is good. Your password: ", haslo)
  25. print(suma)
  26. break
  27.  
  28. else:
  29. print(suma)
  30. if suma < 3:
  31.  
  32. print(suma)
  33.  
  34. print(communicat(haslo), "Write bad password! Count of bad attempts:",
  35. suma, ". You have ", 3 - suma, " chances write your password. ")
  36. # print(
  37. # "Password must contain at least one uppercase character and one number and lengh of password must at least 5 characters! Write bad password! Count of bad attempts:",
  38. #suma, ". You have ", 3 - suma, " chances write your password. ")
  39. suma += 1
  40.  
  41. else:
  42. print("You lost chance. Koniec")
  43. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement