dimanche 10 juillet 2022

Parenthesies and spaces appear when picking a randomly from a list

I am making a username generator, and everything works well, but when I generate my username using the button, unwanted parenthesis, spaces and commas appear. Is there any way I can get rid of this? Any help would be greatly appreciated. I have attached an image and my code below.

The output I was expecting: noobkid12

The output now: ('noobkid', 12)

Link: https://i.stack.imgur.com/CkQKx.png

Code:

import random, tkinter

root = tkinter.Tk()
root.title("usernamegen")
root.geometry("250x65")

adjectives = ["noob","baby","dude","soldier","discount","fiesty","quiet","stealthy","stinky","sly"]
nouns = ["kid","plant","painter","officer","conscience","fox","dog","donut","snake","book"]

def generate():
    output_adjectives = random.choice((adjectives))
    output_nouns = random.choice((nouns))
    end_number = random.randint(1,100)
    output_username = output_adjectives + output_nouns, end_number
    label["text"] = f"Username: {output_username}"

label = tkinter.Label(root, text="Username: ")
label.pack()

button = tkinter.Button(root, text="Generate", command=generate)
button.pack()

root.mainloop()



Aucun commentaire:

Enregistrer un commentaire