Ask coding questions

← Back to all posts
Not working?
Grace55555 (2)

Hii! I copied a code from my CS teacher (also using Replit) as we're going over our weak areas in Python.
For some reason, rather than printing "name is in class 1, class 2, class 3" it's not working properly :/

Answered by DavidSafro (19) [earned 5 cycles]
View Answer
DavidSafro (19)

hehe. this is probably a mistake when you copied it over. but do you see the lines that say classes.append? well when you have that you have to have an argument in parentheses after that. what you have to do is for example in line 10 and 11 you have
("Class 1")

but what you should have is:
classes.append("Class 1")

do that for lines 10 & 11, 15 & 16, and 20 & 21

IntellectualGuy (648)

@Grace55555 I believe that isn't the answer, the thing is when you declaring, classes you accidentally make it a tuple object instead of a list object, so instead replace line 5 with classes = []

DavidSafro (19)

if my answer helped, please upvote and and click the check mark

IntellectualGuy (648)

@DavidSafro Please don't ask for cycles