# Create two sample lists x = [1, 2, 3] y = [10, 20, 30]
# Merge the lists merged = x + y
# Print out the merged list print(list(merged))
[1, 2, 3, 10, 20, 30]
Note that the Python code above merges the lists linearly. If instead you want to create pairs of items from each list, you might want to use the Python zip function:
# Create two sample lists
x = [1, 2, 3]
y = [10, 20, 30]
# Use zip to get item pairs
merged = zip(x, y)
# Print out the merged list
print(list(merged))
Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.