I'm trying to create a piece of code that will generate a random string of characters (upper, lower, digits, and certain symbols) before giving the string a score, and displaying them both. I have created the rating algorithm, but the generation algorithm is giving me some trouble. Here's what I have so far:
def genString():
leng = random.randint(8, 12)
chars = string.ascii_letters + string.digits + "!$%^&*()-_=+"
gend = "".join(random.choice(chars) for n in range(leng))
stringEntry.config(text = gend)
rateString()
In theory, this would modify an entrybox in my Tkinter GUI with the string, before rating it as if the user entered it themselves.
How would I go about making this work?
Aucun commentaire:
Enregistrer un commentaire