Python script Empty List Issue

Hi Ritesh,
Further to @pyXam 's comment would also familiarise yourself with this post How to get help on the Dynamo forums
Finally - it is preferable to start a new topic rather than add to the end of a solution

It would help with a description of the use case or context and what you are trying to achieve rather than providing a code dump. That way you are more likely to get help. I am almost certain that this can be simplified a lot.
Here are some observations

t = math.floor(division_value / 2.5) * 2.5 is used twice in the function - create a helper function at the top like this. Use floor division // instead of math.floor

def calculate_resin_thickness(remaining_thickness, remaining_places):
    def conform_thickness(rt, rp):
        return rt / rp // 2.5 * 2.5  # No imports required using // floor division
    result_array = [0] * remaining_places

There is a potential to handle edge cases - say remaining_places = 1

    if remaining_places = 1:
        return [remaining_thickness]

Is there a reason why you are adding strings to the result?

You can handle individual values and lists with something like this

remaining_thickness = IN[0] if isinstance(IN[0], list) else [IN[0]]
remaining_places = IN[1] if isinstance(IN[1], list) else [IN[1]]

thickness = [
    calculate_resin_thickness(*t_and_p)
    for t_and_p in zip(remaining_thickness, remaining_places)
]
1 Like