Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Removing item by value | Lists
Python Ninja
Sectionย 7. Chapterย 5
ninja.py

ninja.py

index.html

index.html

preset.py

preset.py

bookRemoving item by value

Swipe to show menu

Previously, we removed items from the inventory by index, but itโ€™s also possible to remove items from the inventory by value.

The inventory can contain objects like cat, dog, monkey, chicken, parrot, etc. So, if you want to remove dog from the inventory, you can simply write ninja.inventory.remove("dog").

Task

Swipe to start coding

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Sectionย 7. Chapterย 5
ninja.py

ninja.py

index.html

index.html

preset.py

preset.py

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt