Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1.  
  2. import random
  3.  
  4. def makeRandomPasswordGayan():
  5.   filePath = pickAFile()
  6.   password = ""
  7.   numChars = requestInteger("Enter length of password")
  8.   numPasswords = requestInteger("Enter amount of passwords")
  9.   myList = [None]*numPasswords
  10.   index1 = 0
  11.   while (index1 < numPasswords):
  12.    
  13.     index2 = 0
  14.     while ( index2 < numChars ):
  15.       typeOfChar = random.randint(0,2)
  16.       if typeOfChar == 0:
  17.         password = password + str(random.randint(0,9))  
  18.       elif typeOfChar == 1:
  19.         password = password + chr(random.randint(65,90))
  20.       else:
  21.         password = password + chr(random.randint(97,122))
  22.  
  23.       index2 = index2+1
  24.     index1 = index1+1
  25.  
  26.   myFile = open(filePath,"w")
  27.   myFile.write(str(password))
  28.   myFile.close()
  29.   print password
  30.   print myList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement