Concatinate two lists : List Cancatenation « List « Python






Concatinate two lists

Concatinate two lists
 

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


chest = ["gold", "gems"]
print "You find a chest which contains:"
print chest
print "You add the contents of the chest to your inventory."
inventory += chest
print "Your inventory is now:"
print inventory

           
         
  








Related examples in the same category

1.List concatenation: speedList concatenation: speed
2.Using List OperatorsUsing List Operators
3.Concatenation ( + )
4.List concatenation DemoList concatenation Demo