Skip to content

Instantly share code, notes, and snippets.

@DevloperHS
Created July 13, 2023 15:03
Show Gist options
  • Select an option

  • Save DevloperHS/cca341a21c90ca1f1c3d9530e29c933c to your computer and use it in GitHub Desktop.

Select an option

Save DevloperHS/cca341a21c90ca1f1c3d9530e29c933c to your computer and use it in GitHub Desktop.
How to use zip() in python
# zip in python
# zip function takes in multiple iterables and combines them to form a single iterable object. Let's understand its use case
# 2 iterables
a = [1,2,3]
b = ["one", "two", "three"]
# use normal - error
'''
for i,j in a,b:
print(i,j)
'''
# use zip - works
for i,j in zip(a,b):
print(i,j)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment