Zip It! – Python Challenge

For this challenge, we are going to recreate an existing built-in python function called zip().

The purpose of the zip() function in python is to merge two given lists into a single list of tuples. Each tuple will contain two values: one value from each list being merged.

You can see how the zip() function works using the trinket embed below.

Your task is to create a new function called zipLists() that will behave exactly the same way as the built-in zip() function, using your own algorithm. Your function will need to take two lists as parameters and return a “zipped list of tuples”. To start with, you may assume that both lists provided will be of the same length (contain the same numbers of values). You will then be able to adapt your code to consider the case where one list has less values than the other. In this case you will ignore surplus values.

Python Code

Complete the code below to define and test your own zipLists() function.



The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.4 / 5. Vote count: 43

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!