编程实现:a[0]*b[0] + a[1]*b[1] +...+a[i]*b[j]

>>> a=[1,2,3,4,5]
>>> b=[6,7,8,9,0]

>>> from functools import reduce
>>> from operator import add,mul
>>> reduce(add,map(mul,a,b))
80

>>> filter(lambda x:x>2,a)
[3, 4, 5]

 

相关文章:

  • 2022-12-23
  • 2021-09-09
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-07-20
猜你喜欢
  • 2021-06-13
  • 2022-02-07
  • 2022-12-23
  • 2022-02-26
  • 2021-07-01
  • 2021-06-19
  • 2021-09-18
相关资源
相似解决方案