Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- password = "" #create text field
- i = 1 #i represents the positions in "password"
- while (i <= 10): #password is limited to 10 characters
- rand = random.randint(0,127) #random number between 0-127 (ASCII)
- if (rand < 33 or rand > 122):
- pass #repeat loop without any changes
- else:
- password = password + chr(rand) #insert random generatet character into "password"
- i += 1 #go on to the next position in "password"
- print(password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement