Posted By

maturanti19 on 05/22/19


podla overovanie hesla poziadaviek

Versions (?)

Overovanie hesla podla poziadaviek

 / Published in: Python

over heslo ci ma velke pismenko ci ma aspon osem znakov a ci ma tri cisla

  1. print('Ahoj, vitaj v overovaní hesiel. Silné heslo má ma? aspo? 8 znakov, 1 ve?ké ?íslo a 3 ?íslice. ')
  2. def heslo():
  3. password=input('Vlož heslo na overenie: ')
  4. a=0
  5. b=0
  6. x=['0','1','2','3','4','5','6','7','8','9']
  7. y=['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']
  9. if len(password) <=8:
  10. print('Tvoje heslo je príliš krátke!')
  11. if len(password) >=8:
  12. for i in range(len(password)):
  13. if password[i] in x:
  14. a+=1
  15. if password[i] in y:
  16. b+=1
  17. if a>=3 and b >= 1:
  18. print('Heslo je správne!')
  19. elif a<3:
  20. print('Heslo musí ma? aspo? tri ?ísla, pridaj nejaké!')
  21. elif b==0:
  22. print('Tvoje heslo nemá ve?ké písmenko!')
  23. heslo()
  25. pokracuj=input('Pokra?ova? v overovaní? (iba ano/nie) ')
  26. if pokracuj in 'ano':
  27. heslo()
  28. else:
  29. quit()

Report this snippet  


RSS Icon Subscribe to comments
Posted By: milessmith on June 4, 2019

Thank you so much for this. I was into this issue and tired to tinker around to check if its possible but couldnt get it done. Now that i have seen the way you did it, thanks guys with regards

You need to login to post a comment.