Advertisement
pavlinski78

Untitled

May 23rd, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. from collections import deque
  2.  
  3. names = deque(input().split(' '))
  4.  
  5. toss = int(input())
  6.  
  7. idx = 0
  8.  
  9. while names:
  10.     idx += 1
  11.     person = names.popleft()
  12.  
  13.     if idx % toss == 0:
  14.         if names:
  15.  
  16.             print(f'Removed {person}')
  17.         else:
  18.             print(f'Last is {person}')
  19.     else:
  20.         names.append(person)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement