Combine Python Lists
Combine Python Lists using plus(+)
chars = ['a', 'b', 'c']
total_chars = chars + ['d', 'e']
print(total_items) # ['a', 'b', 'c', 'd', 'e']
Note: This approach not work for adding single item to the list, you can use .append(). Another approach to add one item is to create a new list with a single value and then use the plus symbol to add the list.
Comments
Post a Comment