This is more a python question than a Rhino question, as I am still learning python. So I have a list and I wanted to find the indexes for each item if they occur more than once. The answer I found on Stackover flow was the following:
Fruit = [‘apple’,‘pear’,‘peach’,‘pear’]
index = [i for i, x in enumerate(Fruit) if x == “pear”]
result = [1, 3]
Since this seem extremely condensed, I was wondering if anyone would be willing describe what is happening in lamen terms. I understand what the enumerate() function does where is returns the index and the value of given list, just not sure what the i for i is doing.
Thanks for the help in advance.