List: assign by index : List Assign « List « Python






List: assign by index

List: assign by index
 

inventory = ["sword", "armor", "shield", "healing potion"]

inventory[0] = "crossbow"

print inventory


           
         
  








Related examples in the same category

1.How to Create and Assign Lists
2.How to Update Lists
3.Assign list to a list itemAssign list to a list item
4.List: assign by sliceList: assign by slice