Adventure Rucksack

Using lists in your adventure to store items
Creating and printing a list
rucksack = ["gold coin","rope","cheese roll"]
print(rucksack[0])
print(rucksack[2])
print(rucksack)

#Create a list inside variable rucksack
#Print first item in the list
#Print third item in list
#print whole list

This would output as
>>>
gold coin
cheese roll
['gold coin','rope','cheese roll']
>>>
Note 0 refers to the first item in the list, 1 to the second item etc
You can create an empty list and add things later on in the program.
rucksack = [ ]

Adding items to the end of a list
rucksack = ["gold coin","rope","cheese roll"] #This creates a list called rucksack
rucksack.append("sword") #This adds the sword onto the list rucksack
print(rucksack)
#Print rucksack list
This would output as
>>>
['gold coin','rope','cheese roll','sword']
>>>

Insert item into a specific place in the list

rucksack = ["gold coin","rope","cheese roll"]
rucksack.insert(2,"fried fish") #This will insert fried fish at position 2 in the list
print(rucksack)

This would output as
>>>
['gold coin','rope','fried fish','cheese roll']
>>>
Note 2 is actually third place in the list as first is position 0

Deleting items from a list
rucksack = ["gold coin","rope","cheese roll"]
rucksack.remove("rope") #Removes rope from list
print(rucksack)

This would output as
>>>
['gold coin','cheese roll']
>>>

Checking to see if something is in a list
rucksack = ["gold coin","rope","cheese roll"]
if "cheese roll" in rucksack:
    print("You have a cheese roll")
else:
    print("You don't have a cheese roll")

This would output as
>>>
You have a cheese roll
>>>
You can also use not in such as
if "cheese roll" not in rucksack:

Combining two lists
playerrucksack = ["gold coin","rope","cheese roll"]
chest1 = ["ruby","emerald","Wand of Doom"]
playerrucksack = playerrucksack +chest1
print(playerrucksack)
You can combine two lists
This would output as
>>>
['gold coin','rope','cheese roll','ruby','emerald','Wand of Doom']
>>>