You need to swap the head and the tail of the specified array:

the head (the first half) of array moves to the end, the tail (the second half) moves to the start. 
The middle element (if it exists) leaves on the same position.

Return new array.


 For example:
 ```
    [ 1, 2, 3, 4, 5 ]   =>  [ 4, 5, 3, 1, 2 ]
     \----/   \----/         
      head     tail 
 
    [ -1, 2 ]  => [ 2, -1 ] 
    [ 1, 2, -3, 4, 5, 6, -7, 8 ]   =>  [ 5, 6, -7, 8, 1, 2, -3, 4 ]  
```

Difficulty: introductory

Starter code:

def swap_head_tail(arr):
	

Solutions:
def swap_head_tail(a):
    r, l = (len(a)+1)//2, len(a)//2
    return a[r:] + a[l:r] +  a[:l]

def swap_head_tail(lst):
    n, d = divmod(len(lst), 2)
    return lst[n+d:] + [lst[n]] * d + lst[:n]

def swap_head_tail(arr):
    if len(arr) == 1: return arr
    n = len(arr)//2
    res,res2 = arr[:n],arr[-n:]
    if len(arr) % 2 == 1: res.insert(0,arr[n])
    return res2 + res

def swap_head_tail(arr):
    m = len(arr) // 2
    return arr[-m:] + arr[m:-m] + arr[:m]

def swap_head_tail(arr):
    middle, odd = divmod(len(arr), 2)
    return arr[middle + odd:] + arr[middle:middle+odd] + arr[:middle]

swap_head_tail = lambda a: a[len(a)+1>>1:] + a[len(a)>>1:len(a)+1>>1] + a[:len(a)>>1]

swap_head_tail=lambda a:(lambda m:a[-m:]+a[m:-m]+a[:m])(len(a)//2)

def swap_head_tail(arr):
    print(arr)
    list_arr = [*arr[int(len(arr)/2):], *arr[:(int(len(arr)/2))]]
    list1 = arr[int(len(arr)/2 + 1):]
    list2 = arr[:(int(len(arr)/2))]
    middle = [arr[int(len(arr) / 2)]]
    return list_arr if len(arr) % 2 == 0 else [*list1, *middle, *list2]