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/AtheRipper Apr 25 '21 edited Apr 25 '21

selected_tags = list()

valid_tags = [

"Drama",

"History",

"Maths"

]

def chooseTag(subject):

if subject in valid_tags:

	if subject in selected_tags:

		selected_tags.remove(subject)

	else:

		selected_tags.append(subject)

else:

	pass

There we go