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.
my_list=[1. 4, 2, 3] i want to delete the 4 my from my_list using del.
i want to delete 4 my from my_list using del.
I know nothing about Python, but are you supposed to have a period or comma after the 1?
del you have to specify the index of the value you want to remove.
del some_list # This would remove the value that is at index 5 from some_list
Jane Chester5,411 Points
The delete function using square  brackets looks at the placement of the number. The 4 is located at index 1.
# my_list = [1, 4, 2, 3] del my_list
Darren Joy19,573 Points
I would go with what Ted Sumner said.
i.e. If you are deleting, it chooses what to delete by index, the 1. (period aka dot) in the list [1. 2, 3, 4] is likely going to mess up the count for the indexing.
Stat by fixing that... to a comma... then...
as Jason Anello said, you then have to direct it to the 4 in your del, remember, count or items starts at 0
note: edited it remove answer, which was off anyway
Another thing that you might find is that the first and second number may be ignored because it might be read as a decimal rather than two distinct values. I think that Ted Sumner's response is correct as well.
There is a problem with typos in a question that requires exact syntax.
A quick search came up this this answer, although I still know nothing about python:
del my_list This deletes the from the index position
del my_list(4) This deletes the value.