Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Python Data Types Del

del(planned) doesn't seem to work for this exercise

Anyone else found this?

current_count = 14
planned = 5
upcoming_releases = 2

5 Answers

You don't need to wrap the variable in parentheses :)

Hi 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

del is not a function :) the () are not needed.

Python del operator

remove() however is a function...

Hi 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

The 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.


Oh I get it! del planned Apologies and thanks for the guidance!

oops sorry I was writing the above response to you when you wrote that you got it so sorry about that :)