Small Python Project

So after doing the beginner “Hello World” program in Python, I though I should up my game a bit. Today I was travelling down to some meetings so I figured this out on the train. Biggest issue I’m having with Python at the moment is keeping it all lower case. So I dusted off some old stuff I wrote in a previous life. I’m probably going to keep working on this to make it neater and more polished, but as a first project in Python I think it’s a good start.

import random
str_simple="ab*c@def!gh2ij3kl4m#n5op$6qr7st8u%v9w^x&y(z)"
str_complex="abc8defGHIJghijkl3mnoLMNpqr2st^&)uvwxyz9ABCDE4F7KO6PQRS*(TUVWXYZ!@#5$%_+-="
str_insane="abcd_+e-=fghi2jklmQR9Sn5opMNqrs3tuvIJw4x*(;yzABCD),>EFGH7K@#$%^L8OPTUVW./?XYZ!&'[]}{\|~`:"
complexity = input("How complex do you want your password to be 1 - 3? ")
if complexity == "1":
seed = str_simple
elif complexity == "2":
seed = str_complex
else:
seed = str_insane
slen = len(seed)
def makePassword ():
i = 1
plen = 15
strpass = ""
while i < 15:
#rannum = int((random.random()*slen)+1)
strpass = strpass + seed[int((random.random()*slen)+1)]
i += 1
return strpass
print(makePassword())

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.