Advertisement
GCK

GCK/ Password generator

GCK
Sep 23rd, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. def character_generator():
  2.     list=["a","b","c","d","e","f","g","h","i","g","k","l","m","n","o","p","q","r","s","t","u","v",
  3.     "w", "x", "y", "z","1","2","3","4","5","6","7","8","9","@","_","-","!"]
  4.     myChoice=choice(list)
  5.     for item in list[:26]:
  6.         if myChoice==item:
  7.             case_random=randint(0,1)
  8.             if case_random==0:
  9.                 myChoice=myChoice.upper()
  10.             else:
  11.                 myChoice=myChoice.lower()
  12.     return myChoice
  13.          
  14.  
  15.  
  16. def random_password(length):
  17.     passW=""
  18.     for i in range(length):
  19.         passW=passW + character_generator()
  20.     return passW
  21.        
  22.        
  23.        
  24. passWord=random_password(int(input("what is the password length? >")))
  25. print("My passWord is : " + passWord)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement