daily pastebin goal
91%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. queue = []
  2. actual_pos = 0
  3. target_pos = 0
  4. step = 5
  5.  
  6. while True:
  7.     p = input("PosiciĆ³n deseada: ")
  8.     if p.isnumeric():
  9.         queue.append(int(p))
  10.     target_pos = queue[0]
  11.  
  12.     if target_pos > actual_pos:
  13.         actual_pos += step
  14.         if actual_pos > target_pos:
  15.             actual_pos = target_pos
  16.  
  17.     elif target_pos < actual_pos:
  18.         actual_pos -= step
  19.         if actual_pos < target_pos:
  20.             actual_pos = target_pos
  21.     if target_pos == actual_pos:
  22.         queue.pop(0)
  23.  
  24.     print(actual_pos, target_pos)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top