# 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))
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.