List: assign by slice : List Assign « List « Python






List: assign by slice

List: assign by slice
 
inventory = ["sword", "armor", "shield", "healing potion"]

inventory[4:6] = ["orb of future telling"]

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 indexList: assign by index