Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

multiply every nth element

# 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)
 
PREVIOUS NEXT
Tagged: #multiply #nth #element
ADD COMMENT
Topic
Name
1+5 =