Computing

Python Pass Gen (Similar to random.org)

Submitted by tnxbt, , Thread ID: 52052

Thread Closed
19-10-2017, 10:47 PM
This post was last modified: 19-10-2017, 10:49 PM by tnxbt
#1
For anyone starting to learn python, have a change around with this which will help learn some basic validation and variable handling. I made this just now and commented on lines to help explain whats going on, it's not meant to be super efficient, I only quickly made this to show something you can do in python.
[Image: 0jWBE9ywScCoz3DCnWyYSg.png]

Code:
import os, string, random

length = input("Length : ")# String input
while length.isnumeric == False:# While the input is not numbers ask again until is.
length = input("Length : ")
length = int(length)# Turns the variable into an integer

amount = input("Amount : ")# While the input is not numbers ask again until is.
while amount.isnumeric == False:
amount = input("Amount : ")
amount = int(amount)# Turns the variable into an integer

for m in range(amount):#Creates a new one until reaches amount wanted
characters = string.ascii_letters + string.digits + "()*%" #includes all letters and digits, but for stronger pass added symbols
random.seed = (os.urandom(512)) # 512 is overkill, only really need 64 or less. To put it into easy terms, makes it more random.
print ("".join(
random.choice(characters) # Randomly selects one of the characters from the variable above
for i in range(length)# adds a random letter until reaches length
)
)
Making a program and need help with a problem? PM me.
A-N

Users browsing this thread: 1 Guest(s)