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 trialRebecca Pope
Courses Plus Student 417 Pointsdel(planned) doesn't seem to work for this exercise
Anyone else found this?
current_count = 14
planned = 5
upcoming_releases = 2
del(planned)
5 Answers
Shawn Denham
Python Development Techdegree Student 17,801 PointsYou don't need to wrap the variable in parentheses :)
Rebecca Pope
Courses Plus Student 417 PointsHi shawn,
Thanks for getting back to me; as del is a function and planned is a variable, you do need this format. What's strange is that the code above worked fine in terminal, just not in the html exercise page :( it is this error that I'm flagging to, cheers
Shawn Denham
Python Development Techdegree Student 17,801 Pointsdel is not a function :) the () are not needed.
remove() however is a function...
Rebecca Pope
Courses Plus Student 417 PointsHi shawn, ace thank you for clarifying! So I should have used remove(planned) - good to know. How would you use the del operator (as the example asks 'can you add a new line to delete the planned variable? Use the del keyword, don't just delete the line'). Many thanks in advance
Shawn Denham
Python Development Techdegree Student 17,801 PointsThe del operator would be used exactly how you used it...you just don't need the () so..
current_count = 14
planned = 5
upcoming_releases = 2
del planned
I have never really used the del operator but it appears that it is mostly used to delete items out of an array so.
del myArray[3]
which would delete the 4 item in they array name myArray.
I hope that makes sense.
cheers!
Rebecca Pope
Courses Plus Student 417 PointsOh I get it! del planned Apologies and thanks for the guidance!
Shawn Denham
Python Development Techdegree Student 17,801 Pointsoops sorry I was writing the above response to you when you wrote that you got it so sorry about that :)