multiply every nth element

Solutions on MaxInterview for multiply every nth element by the best coders in the world

showing results for - "multiply every nth element"
Nico
18 May 2019
1# multiply every Nth element
2numbers = [1,2,3,4,5,6]
3N = 7
4M = 2
5for i in range(N - 1, len(numbers), (N)):
6    (numbers)[i] = (numbers)[i] * (M)
7print(numbers)
similar questions
queries leading to this page
multiply every nth element