val, idx = min((val, idx) for (idx, val) in enumerate(my_list))
This statement gives the minimum and the index of that minimum. I am curious to know how this works.
I did type((value, index) for index, value in enumerate(percent_chance_per_stock) if value > 0)
and got <class 'generator'>
. How does it work in conjunction with min function and return a tuple?