![](/img/trans.png)
[英]I have to write a function that has two arguments(two lists of numbers, and returns its inner product), without using list comprehension, any ideas?
def inner_product(vec1,vec2): if len(vec1)==len(vec2) and len(vec1)!=0: return sum([vec1[n]*vec2[n] for n in range(len(vec1))]) else: ...