Why do I get TypeError: 'builti_function_or_method' object is not subscriptable in row 2? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why do I get TypeError: 'builti_function_or_method' object is not subscriptable in row 2?

You decided to create a list of fruits to buy and one item was wrong in the list. Remove the wrong item and print the new list. fruits = ['apple', 'orange', 'cucumber', 'mango', 'pineapple'] removed_fruit = fruits.remove[2] print(fruits) print(removed_fruit)

31st Oct 2021, 12:36 PM
Neethu Nath
Neethu Nath - avatar
2 Answers
+ 1
.remove() uses the value you want to remove, not the index. To delete an item using its index use the del() function. https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/gloss_python_remove_list_items.asp
31st Oct 2021, 12:48 PM
Simon Sauter
Simon Sauter - avatar
+ 1
Thank you Simon Sauter
31st Oct 2021, 1:01 PM
Neethu Nath
Neethu Nath - avatar