'what is the purpose of keeping [0] in the list function

available_terminals is a list that stores some values and I don't get why [0] is there in the end:

available_terminals = list(np.where(dist_x_y<r)[0])

I tried running the code with and without [0] here are the outputs respectively:

  • with [0]:

    [1, 4, 5, 10, 14, 18, 19, 21]
    
  • without [0]:

    [array([ 1,  4,  5, 10, 14, 18, 19, 21], dtype=int64)]
    

What difference does the [0] make ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source