0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
A natural way to organize and store data is in a List
. Some languages call them "arrays", but in Python we just call them lists. Think of all the apps you use and how many of the items in the app are organized into lists.
For example:
Lists in Python are declared using square brackets, with commas separating each item:
inventory = ["Iron Breastplate", "Healing Potion", "Leather Scraps"]
Lists can contain items of any data type, in our example above we have a List
of strings.
Let's work on Fantasy Quest's inventory! We can store items the player is carrying in a list!
Fix our get_inventory
function by adding Shortsword
to the end of the list.
Focus Editor
Alt+Shift+]
Become a member to Submit
Become a member to Run
Become a member to view solution