I have a list the_list = [[3, 2, 0, 1, 4, 5], [4, 2, 1, 3, 0, 5], [0, 1, 2, 3, 4, 5], [1, 5, 2, 4, 3, 0]]
. How to find out the distance from the smallest element to the largest element in the list. For example, for the first subscriptions in the the_list
index for the smallest element 0
is 2
, and the index for the largest element 5
is equal 5
. Therefore, the distance between the two indices is equal. 3
Thus, I get the following output:
3
1
5
0
Change: . For the last output, it is 0, because the list ends there and assumes that the list only looks for the distance to the right
source
share