﻿ Python: Zip two given lists of lists - w3resource

# Python: Zip two given lists of lists

## Python List: Exercise - 89 with Solution

Write a Python program to Zip two given lists of lists.

Visual Presentation:

Sample Solution:

Python Code:

``````# Create two lists 'list1' and 'list2' containing sublists of numbers
list1 = [[1, 3], [5, 7], [9, 11]]
list2 = [[2, 4], [6, 8], [10, 12, 14]]

# Print a message indicating the original lists
print("Original lists:")

# Print the contents of 'list1'
print(list1)

# Print the contents of 'list2'
print(list2)

# Use the 'map' function to add corresponding sublists from 'list1' and 'list2' together

# Print a message indicating the zipped list
print("\nZipped list:\n" +  str(result))
```
```

Sample Output:

```Original lists:
[[1, 3], [5, 7], [9, 11]]
[[2, 4], [6, 8], [10, 12, 14]]

Zipped list:
[[1, 3, 2, 4], [5, 7, 6, 8], [9, 11, 10, 12, 14]]
```

Flowchart:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿