# -*- coding: utf-8 -*-
#
HOW TO MAKE PASSWORD
#
BY ZHANGTAO
import random,sys,time

def main():
    if len(sys.argv) != 2:
        print "usage:python {0} length_of_password".format(sys.argv[0])
        return
    c=sys.argv[1]
    c=int(c)
    a1="123456789"
    a2="qwertyuipasdfghjklzxcvbnm"
    a3="QWERTYUIOPADFGHJKLZXCBNM"
    a4="@$&"
    aList=[a1,a2,a3,a4]
    s=""
    aLast=5

    for i in xrange(c):
        while True:
            a = random.choice(aList)
            if len(a) != aLast:
                aLast=len(a)
                if aLast == len(a4):
                    aList = [a1, a2, a3]
                break
            time.sleep(0.1)
        s += random.choice(a)

    print "make password:",s
    print "len :",len(s)


if __name__=="__main__":
    main()