I have some code written here for a Codio challenge that I can't seem to figure out how to correctly write. I'm fairly new to Python and for some reason this times table loop challenge is killing me. The code is as follows:
# Get N from the command line
import sys
N = int(sys.argv[1])
for i in range(1, 13):
N = N + i
print(str(N))
The question asks:
We will provide you with a number N. Output the times table for that number from 1 to 12.
So, if we pass in 6, you should output 6, 12, 18, 24 … 66, 72
Any help would be greatly appreciated.
You are adding the loop index to the number
N
, you need to multiply instead.