セクション 7. 章 2
ninja.py
index.html
preset.py
Changing value by index
メニューを表示するにはスワイプしてください
To modify a specific element, access the list at the desired index and assign it a new value. For example:
123456789# Existing list inventory = ["cat", "dog", "chicken", "monkey"] # Change the second element inventory[1] = "parrot" # inventory is now ["cat", "parrot", "chicken", "monkey"] print(inventory)
You can also change an item in the ninja's inventory by index. To do this, you can pass the index to the ninja.pick_to_inventory(index) method.
ninja.py
タスク
スワイプしてコーディングを開始
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 7. 章 2
ninja.py
index.html
preset.py
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください