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! While you're at it, check out some resources Treehouse students have shared here.
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 trialSim Jia Yang
Courses Plus Student 1,598 Pointslist.remove challenge part 2 HELP
Hi, could any1 check my code and see what's wrong with it?
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5
]
states.remove(5, ['red','green','blue'])
3 Answers
Ignazio Calo
Courses Plus Student 1,819 PointsOf course to pass the challenge you need to remove both the elements:
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5,
]
states.remove(5)
states.remove(['red', 'green', 'blue'])
Ignazio Calo
Courses Plus Student 1,819 PointsThe remove()
function accept only one parameter as you can see here on the documentation.
https://docs.python.org/3/library/array.html?highlight=remove#array.array.remove
states = [
'ACTIVE',
['red', 'green', 'blue'],
'CANCELLED',
'FINISHED',
5
]
states.remove(5)
works as expected
Sim Jia Yang
Courses Plus Student 1,598 PointsOkay. But if i just add only
states.remove(['red', 'green', 'blue'])
I still cant get the correct ans. Cheers.
Assma Al-Adawi
8,723 PointsWhen I try to copy your code it passes. Have you done each removal on a separate line? E.g
states.remove(5) states.remove(['red', 'green', 'blue'])
If so, it should pass.
Sim Jia Yang
Courses Plus Student 1,598 PointsSim Jia Yang
Courses Plus Student 1,598 PointsOk thank you. I got it. :)