Python Forum
Zip Keyword in For loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Zip Keyword in For loop
#1
import numpy as np

a = np.array([1, 2])
b = np.array([2, 1])

dot = 0

for e, f in zip(a, b):
    dot = dot + e*f
print(dot)
So after running this the answer is 4, but I don't understand what
the zip keywords functionality is in this loop, in fact I don't understand
any of the loop, can somebody please explain.
Reply


Messages In This Thread
Zip Keyword in For loop - by 6pathsMadara - Nov-05-2018, 02:12 PM
RE: Zip Keyword in For loop - by ichabod801 - Nov-05-2018, 02:33 PM
RE: Zip Keyword in For loop - by 6pathsMadara - Nov-05-2018, 02:42 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020