Write a code that receives an array of numbers or strings, goes one by one through it while taking one value out, leaving one value in, taking, leaving, and back again to the beginning until all values are out.  
It's like a circle of people who decide that every second person will leave it, until the last person is there. So if the last element of the array is taken, the first element that's still there, will stay.  
The code returns a new re-arranged array with the taken values by their order. The first value of the initial array is always taken.

Examples:

Difficulty: introductory

Starter code:

def yes_no(arr):
	

Solutions:
from collections import deque

def yes_no(arr):
    d, result = deque(arr), []
    while d:
        result.append(d.popleft())
        d.rotate(-1)
    return result

def yes_no(arr):
    result = []
    while arr:
        result.append(arr.pop(0))
        if arr:
            arr.append(arr.pop(0))
    return result

def yes_no(arr):
    result, i = [], 0
    while arr:
        result.extend(arr[i::2])
        j = i != len(arr) % 2
        arr = arr[1-i::2]
        i = j
    return result

from collections import deque


def yes_no(arr):
    d = deque(reversed(arr))
    result = []
    while d:
        result.append(d.pop())
        d.rotate()
    return result

def yes_no(arr):
    new = []
    take = True
    while arr:
        if take:
            some = arr.pop(0)
            new.append(some)
            take = False
        else:
            some = arr.pop(0)
            arr.append(some)
            take = True
    return new

def yes_no(a):
    if len(a)<=1: return a
    a.append(a.pop(1))
    return [a.pop(0)] + yes_no(a)


def yes_no(arr):
    counter = 0
    out = []
    _in = []
    while arr:
        for i in arr:
            if counter % 2 == 0:
                out.append(i)
            else:
                _in.append(i)
            counter += 1
        arr = _in
        _in = []
    return out

def yes_no(ar, i = 0):
    red = []
    while ar:
        i = [i, i % max(1,len(ar)) ][all((ar, i >= len(ar)))]
        red.append(ar.pop(i))
        i += 1
    return red


def yes_no(arr, x=0):
    if len(arr) <= 1: return arr
    return arr[x::2] + yes_no(arr[1-x::2], x+len(arr)&1)

def yes_no(arr):
    r = []
    for i in range(0, len(arr) * 2 - 1, 2):
        r.append(arr[i]) # using only append because it is o(1), while remove is o(n)
        if i < len(arr) - 1:
            arr.append(arr[i+1])
    return r