i have a 2 sets of lists, the first one is from the spreadsheet which indicates the sizes of pit structures, the other one is a nested list “Pipe Network Sizes”. I tried to create a Python script to match the sizes from the spreadsheet and create a new set of list equivalent to its Part Size using the index. The scripts that i made doesn’t evaluate the “if” statement and always went into the “else” statement and returns all the first index in every set of list.
Can anyone help me or suggest me if my script is right?
To answer your question, you need another for loop like:
for Pit in Pit_Data:
for y in range(len(Pit_Size)):
Your original for loop is also incorrect as you’re using the values in the range, not the values in Pit_Size. I think you actually want:
for y in Pit_Size:
However, all you really need is a dictionary. Lookup how to setup and use dictionaries and that should be exactly what you’re looking for without the hassle of writing python code.