What is the output of the following? print(list(zip([1,2,3], ‘abc’)))

Python Developer Medium

Python Developer — Medium

What is the output of the following? print(list(zip([1,2,3], ‘abc’)))

Key points

  • Zip function pairs elements from two iterables
  • List function converts the zip object into a list
  • Tuples in the output contain elements from the input lists
  • The correct answer is a list of tuples with corresponding elements

Ready to go further?

Related questions