I have a list like the following:
list1 = [['Dog', 'Cat', 'Chicken'], ['Cow', 'Pig', 'Sheep'], ['Lizard', 'Fish', 'Goat']]
I would like to add a string, i.e. "Hi", to each element in each list within list1.
So that it would be the following:
list1 = [['DogHi', 'CatHi', 'ChickenHi'], ['CowHi', 'PigHi', 'SheepHi'], ['LizardHi', 'FishHi', 'GoatHi']]
I have tried this simple code but the output is just the initial list.
for sublist in list1:
for each_word in sublist:
each_word = each_word + "Hi"
Any advice would be appreciated, I am sure the solution is trivial. Thanks!