# the basic way
s = 0
for x in range(10):
    s += x

# the right way
s = sum(range(10))


# the basic way
s = 1
for x in range(1, 10):
    s *= x

# the other way
from operator import mul
reduce(mul, range(1, 10))

相关文章:

  • 2021-10-05
  • 2022-01-13
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-24
  • 2021-11-28
  • 2021-07-26
  • 2021-05-29
  • 2021-05-25
  • 2022-12-23
相关资源
相似解决方案