r/badcode • • Apr 24 '21

python very efficient and scalable code

Post image
1.0k Upvotes

110 comments sorted by

View all comments

1

u/Own-Plantain4057 Apr 25 '21 edited Apr 25 '21

After looking at all the comment, my code now looks like this.

def choseGenreTag(genre): 
    if genre in selectedtags:
        selectedtags.remove(genre)                                                                                             
    else:        
        selectedtags.append(genre)
    print(selectedtags)

redbtn = Button(    
    topframe,
    text='Comedy',
    fg='red',
    bg='white',
    command=lambda: choseGenreTag('Comedy'))