Use Python Node to Build Two Lists of Numbers Based on User Inputs

Hello,

I am hoping to get some help with a python code that I would like to like. I will explain a scenario below.

The user would input a start number, end number, amount to add, and number of times to perform the operation. The python script would then build two separate lists. A list of starting numbers, and a list of ending numbers.

For example Inputs:
start = 1000
end = 2700
length = 400
num_times = 5

Program would return:
start_list = (1000,1400,1800,2200,2600)
end_list = (1400,1800,2200,2700)

Is this a simple loop to write? I have been working with loops some, but have not been able to figure this one out.

Hi @hestingjj,
You might no need a loop for this. You can use the range function & list splicing like this:

OUT = [range(IN[0],IN[1],IN[2])[:IN[3]],range(IN[1],IN[0],-IN[2])[:IN[3]]]
1 Like