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

Brandon Galde
Brandon Galde
12,741 Points

Can't use the del keyword to delete planned

I added line del(planned) to the end of the delete.py, resulting in the following contents:

current_count = 14 planned = 5 upcoming_release = 2 del(planned)

This works in testing, so I am confused as to why It is incorrect.

current_count = 14
planned = 5
upcoming_releases = 2

2 Answers

28,521 Points

While del(planned) is technically valid it is somewhat uncommon to use parenthesis when using keywords in Python. Since del is a keyword and not a function you should use a space to separate the value and the del keyword instead of parenthesis. Like this:

del planned

The challenge checker for this challenge is only setup with that coding style in mind.

Grrrrr.... We answered at the same time AGAIN....

Brandon Galde
Brandon Galde
12,741 Points

ah, so that would be the difference between a keyword and a method I suppose, and python 3.5 just so happen to support both. Thanks for the response!

You code looks fine.

Maybe remove the parentheses? I don't know; sometimes code challenges can be very picky. You gotta try every little tweak :smile:

I'm not 100% sure, but this might work:

del planned

It is more common in Python to write keywords without parentheses, so it's good to try this :)

I hope this post helps.

Good luck! ~Alex