Overwriting output froma print statement

Hi thank you , this is the desired behaiviour , but for my case , it gives an error. I am trying to iterate over the 1D list velocity , does it need to be a certain type for it to work ? The error i get is as follows

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()