Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- We are passing in 3 inputs.
- a list of numbers
- a multiplier value, M
- a value, N
- You should multiply every Nth element (do not multiply the 0th element) by M. So, if N is 3, you start with the 3rd element, which is index 2.
- If there are less than N elements then you should output the unchanged input list.
- *********************************************************************************************
- # Get our input from the command line
- import sys
- M= int(sys.argv[2])
- N= int(sys.argv[3])
- # convert strings to integers
- numbers= sys.argv[1].split(',')
- for i in range(0, len(numbers)):
- numbers[i]= int(numbers[i])
- # Your code goes here
- for N in numbers:
- if numbers[i]>0:
- total =N * M
- print(total)
- else:
- print(numbers)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement