@@ -0,0 +1,811 @@
+from random import randint%0Aimport MySQLdb%0Adef makeCode(length,number):%0A    code = %5B%5D%0A    code_set = set(code)%0A    code_map = %220123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ%22%0A    limit = len(code_map)%0A    while(len(code_set)%3Cnumber):%0A        this_code = %22%22%0A        for i in range(length):%0A            this_code += code_map%5Brandint(0,limit-1)%5D%0A        code.append(this_code)%0A        code_set = set(code)%0A%0A    return code_set%0A%0Adef insertDatebase(code):%0A    db = MySQLdb.Connect(%22localhost%22,%22root%22,%22%22,%22pythonmysql%22)%0A    cursor = db.cursor()%0A    sql = %22%22%22INSERT INTO my_practice%0A         VALUES ('%25s')%22%22%22 %25 code%0A    try:%0A        cursor.execute(sql)%0A        db.commit()%0A    except:%0A        db.rollback()%0A    db.close()%0A%0Aif __name__ == '__main__':%0A    codes = makeCode(20,200)%0A    for code in codes:%0A        insertDatebase(code)

add a solution