10-30-2009, 08:14 PM
Why are there spaces in between the letters number and symbols? how do I get rid of them?
Code:
import os
import random
while True:
a = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
b = [1,2,3,4,5,6,7,8,9]
c = [',','.',';',':','-','+']
d = ['!','@','#','$','%','^','&','*','(',')']
e = random.choice(a)
f = random.choice(b)
g = random.choice(c)
h = random.choice(d)
i = [e,f,g,h]
j = random.choice(i)
k = int(raw_input("How Many characters should be in your password?: "))
if k == 1:
print random.choice(i)
elif k == 2:
print random.choice(i),random.choice(i)
elif k == 3:
print random.choice(i),random.choice(i),random.choice(i)
elif k == 4:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 5:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 6:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 7:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 8:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 9:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 10:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 11:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 12:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 13:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 14:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 15:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)
elif k == 16:
print random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i),random.choice(i)