Create a gh like series with Python?



Hi everyone,

I was wondering how one could define a function similar to the Series in grasshopper, with (Start, Step, Count).
Most of the things I have searched online make use of a while loop or range function, but in this way you cannot control the exact amount of items that you want in the list…

Thanks for any insight


What about this?

start = 0
step = 1
count = 10

values = [start + (c * step) for c in range(count)]


Thank you Mostapha, that was it!


I think range(Start,Count*Step,Step) alone might do it.

Edit: It does:



Could it that when you change the step it stops working? Or am I doing something wrong?


Ah yes, no I forgot to add the Start value parameter to the range() stop parameter: