📜  将每第 n 个元素相乘 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:33.564000             🧑  作者: Mango

代码示例1
# multiply every Nth element
numbers = [1,2,3,4,5,6]
N = 7
M = 2
for i in range(N - 1, len(numbers), (N)):
    (numbers)[i] = (numbers)[i] * (M)
print(numbers)