Here is a sample code that iterates through a lists and returns another one.
In your sample you are creating a list (distances) but you are never modifying or adding anything to that list. This is the reason your output is empty.