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

10 Answers

Kevin Faust
Kevin Faust
15,353 Points

Yasser Shaaf

#WRONG SOLUTION
current_count = 14
del planned = 5  #you are trying to assign the "planned" variable to the number 5 and trying to delete it at the same time
upcoming_releases = 2
total = current_count + upcoming_releases



#CORRECT SOLUTION
current_count = 14
planned = 5     #planned variable exists
upcoming_releases = 2

del planned    #we delete that planned variable
total = current_count + upcoming_releases

What you did was the first block of code above. The correct code is the one below it. You are not supposed to modify the given variables. Take a look at the comments I put in the above code. Tell me if you understand and if it works now

Kevin Faust
Kevin Faust
15,353 Points

Challenge 1: easily delete planned

del planned

Challenge 2: add up the two things that the instructions said to add and assign to variable called "total"

total = current_count + upcoming_releases
Kevin Faust
Kevin Faust
15,353 Points

I tried it and it works perfectly fine. maybe try switching browsers?

Yasser Shaaf
seal-mask
.a{fill-rule:evenodd;}techdegree
Yasser Shaaf
UX Design Techdegree Student 13,864 Points

invalid syntax (delete.py, line 2) when i solved the 2 challenge , i see this phrase invalid syntax (delete.py, line 2)

Kevin Faust
Kevin Faust
15,353 Points

can you post your code that you have?

Kevin Faust
Kevin Faust
15,353 Points

select all your code, press ctrl + c, then do ctrl + v here

Kevin Faust
Kevin Faust
15,353 Points

Where is your planned variable?? That is not what i wrote. Please read what i wrote above.

Kevin Faust
Kevin Faust
15,353 Points

Lol this challenge was not too difficult but its ok if you have troubles. Learning is never easy