num_list_1 = [10, 20, 30, 40]
num_list_2 = [50, 60]
concatenated_list = num_list_1 + num_list_2
print(concatenated_list)
Output:
Example 2: Using the built-in extend() method from List Class
countries1 = ["USA", "Canada", "Mexico"]
countries2 = ["Germany", "France", "Spain"]
countries1.extend(countries2)
concatenated_list = countries1
print(concatenated_list)
Output:
Example 3: Using the built-in append() method from List Class
genres1 = ["Rock", "Pop", "Hip Hop"]
genres2 = ["Jazz", "Country", "Reggae"]
for genre in genres2:
genres1.append(genre)
concatenated_list = genres1
print(concatenated_list)
Example 4: Using the * Operator and List Unpacking
list1 = [1, 2, 3, 4, 5]
list2 = [6, 7]
concatenated_list = [*list1, *list2]
print(concatenated_list)
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!