Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def communicat(sentence):
- finish_com = []
- if not any(char.isdigit() for char in sentence):
- finish_com.append("Password must contain at least one number")
- if not any (char.isupper() for char in sentence):
- finish_com.append("Password must contain at least one upper character")
- if len(sentence)<5:
- finish_com.append("Minimum length of password must consist of 5 characters")
- #print(finish_com)
- komunikaty = "\n".join(finish_com)
- #print(komunikaty)
- return komunikaty
- suma = 1
- while True:
- haslo = input("Please write your password: ")
- if any(char.isdigit() for char in haslo) and any(char.isupper() for char in haslo) and len(haslo) >= 5:
- print("Password is good. Your password: ", haslo)
- print(suma)
- break
- else:
- print(suma)
- if suma < 3:
- print(suma)
- print(communicat(haslo), "Write bad password! Count of bad attempts:",
- suma, ". You have ", 3 - suma, " chances write your password. ")
- # print(
- # "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:",
- #suma, ". You have ", 3 - suma, " chances write your password. ")
- suma += 1
- else:
- print("You lost chance. Koniec")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement