title: How to put values of different cycle of "for" in unique lists? python
body: <p>frames_ID is a nested list that contains several inner lists (trials). I want to calculate the velocity for each trial and keep the value for the velocity of each trial in a separate list.
  My current code adds velocity for all trials into a single list (vel) and makes one big list. How can I change (vel) to a nested list that contains velocity for each trial in the unique lists?</p>
  <pre><code>vel=[]
  for trial in range(len(frames_ID)):
      for k in range(len(frames_ID[trial])-1):
          if(frames_ID[trial][k+1] - frames_ID[trial][k]) &lt; -(np.pi): 
              velocity =((frames_ID[trial][k+1] - frames_ID[trial][k])/(0.01)+ 2*np.pi) 
              vel.append(velocity)
          elif (frames_ID[trial][k+1] - frames_ID[trial][k]) &gt; np.pi: 
              velocity =((frames_ID[trial][k+1] - frames_ID[trial][k])/(0.01)- 2*np.pi)
              vel.append(velocity)
          else:
              velocity =(frames_ID[trial][k+1] - frames_ID[trial][k])/0.01
  
              vel.append(velocity)
  </code></pre>