Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Tolgay Yilmaz306 Points
task wants me to remove the last item, which is: '5', but when I type states.remove('5'): don't change states directly.
task wants me to remove the last item, which is: '5', but when I type states.remove('5'), It is prompted I shouldn't directly change the variable: states. then I tried to assign remove operation to states variable back, that also wouldn't work.
thing is, it works on the console interpreter just fine.
states = ['ACTIVE', ['red', 'green', 'blue'], 'CANCELLED', 'FINISHED', '5'] states = states.remove('5')
Jennifer NordellTreehouse Teacher
You've told it to remove the the string '5' which doesn't exist. The 5 in there is an integer. Just drop the quotes and you should have it. Take a look here:
states = [ 'ACTIVE', ['red', 'green', 'blue'], 'CANCELLED', 'FINISHED', 5, ] states.remove(5)