Advertisement
here2share

# loop-de-loop.py

Jul 7th, 2019
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. # loop-de-loop.py -- loop-de-loop-de-loop... bork-bork-bork!
  2.  
  3. def loop(v,i):
  4.     if v:
  5.         try:
  6.             x,y,z = v[i]
  7.         except:
  8.             z = 1
  9.             x,y = v[i]
  10.         xx = x + z
  11.         if (x > y and xx <= y) or (x < y and y <= xx):
  12.             v.pop(i)
  13.         else:
  14.             v[i] = xx, y, z
  15. 0
  16. loops = [(400,-50,-50),(0,100,20),(0,-500,-50),(25,0,-3),(0,10)]
  17. while loops:
  18.     print [z[0] for z in loops[:3]]
  19.     for r in range(min(2,len(loops)-1),-1,-1):
  20.         loop(loops,r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement