CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
7
Task/Dot-product/Python/dot-product.py
Normal file
7
Task/Dot-product/Python/dot-product.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
def dotp(a,b):
|
||||
assert len(a) == len(b), 'Vector sizes must match'
|
||||
return sum(aterm * bterm for aterm,bterm in zip(a, b))
|
||||
|
||||
if __name__ == '__main__':
|
||||
a, b = [1, 3, -5], [4, -2, -1]
|
||||
assert dotp(a,b) == 3
|
||||
Loading…
Add table
Add a link
Reference in a new issue