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 trial

Python Python Basics (2015) Python Data Types Del

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.

delete.py
current_count = 14
planned = 5
upcoming_releases = 2
del(planned)

2 Answers

andren
andren
28,558 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....

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