Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nums = [x for x in input().split()]
- count = int(input())
- new = []
- while True:
- if len(nums) < count:
- other = nums + nums[:count-len(nums)]
- new.append(other[count-1])
- nums.pop(nums.index(other[count-1]))
- else:
- new.append(nums[count-1])
- nums = nums[count:] + nums[:count-1]
- if len(nums) == 1:
- new.append(nums[0])
- break
- print('['+','.join(new)+']')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement