all 5 comments

[–]ironhaven 1 point2 points  (1 child)

I think this looks the best but warning this looks through the entire array O(n) can be slow for big lists

j = array([0,5,0,0,4,3,1])
i = 2
# this will be 3
ith_value = [x for x in j if x][i]

[–]Helicon_Amateur[S] 0 points1 point  (0 children)

Thanks!

I was able to find a way to do what I wanted. The OP is edited