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 trialSean Fitzpatrick
198 Pointshow do i delete a variable
i've tried using del planned =5 with no luck, i've also tried del current with no outcome what am i doing wrong
current_count = 14
planned = 5
upcoming_releases = 2
del current_count = 14
del planned_5
del planned_5
del planned=5
planned = 5
del '5'
del var = 'planned = 5'
del 'planned'
del " planned "
del current_count - '5'
del current_count = 14
2 Answers
Vibhutha Kumarage
3,095 PointsHello Sean Fitzpatrick,
del keyword is used to delete variable. In your code you tried to delete variables with assignments. It not work. Just use the variable name after the del
del current_count
Sean Fitzpatrick
198 Pointsdel 5?
Vibhutha Kumarage
3,095 PointsNo use variable name..
example:
If you want to delete item from a list,
my_list = [1, 2, 3, 4, 5]
del my_list[1]
will delete '2' from the list.
Sean Fitzpatrick
198 PointsSean Fitzpatrick
198 PointsThanks I was on the wrong line, I figured it out finally. thank you for the help.. ??