While most devs know about [big/little-endianness](https://en.wikipedia.org/wiki/Endianness), only a selected few know the secret of real hard core coolness with mid-endians.

Your task is to take a number and return it in its mid-endian format, putting the most significant couple of bytes in the middle and all the others around it, alternating left and right.

For example, consider the number `9999999`, whose hexadecimal representation would be `98967F` in big endian (the classic you get converting); it becomes `7F9698` in little-endian and `96987F` in mid-endian.

Write a function to do that given a positive integer (in base 10) and remembering that you need to pad with `0`s when you get a single hex digit!

Difficulty: introductory

Starter code:

def mid_endian(n):
	

Solutions:
import re
def mid_endian(n):
    h= hex(n)[2:].upper()
    r= re.findall('..','0'*(len(h)%2)+h)
    return "".join(r[1::2][::-1]+r[0::2])

def mid_endian(n):
    bs = n.to_bytes((n.bit_length() + 7) // 8 or 1, byteorder='little')
    return (bs[len(bs)%2::2] + bs[::-2]).hex().upper()

from collections import deque

def mid_endian(n):
    h, m = hex(n)[2:].upper(), deque()
    if len(h) & 1: h = '0' + h
    for i in range(len(h) >> 1):
        if i & 1: m.appendleft(h[i << 1: i + 1 << 1])
        else: m.append(h[i << 1: i + 1 << 1])
    return ''.join(m)

def mid_endian(n):
    x = format(n, 'X')
    xs = [a+b for a, b in zip(*[iter('0' * (len(x) % 2) + x)]*2)]
    return ''.join(xs[1::2][::-1] + xs[::2])

import re
def mid_endian(n):
    t = f'{n:X}'
    t = '0' + t if len(t) % 2 else t

    odds, evens = [], []
    for i, f in enumerate(re.findall(r'..', t), start=1):
        if i % 2:
            odds.append(f)
        else:
            evens.append(f)
    return ''.join(list(reversed(evens)) + odds)

from re import findall; from functools import reduce; mid_endian=lambda n: reduce(lambda a,b: b[1]+a if b[0]%2 else a+b[1], enumerate(findall(r".{2}", (lambda h: ("0" if len(h)%2 else "")+h)(hex(n)[2:].upper()))), "")

def mid_endian(n):
    x = hex(n)[2:]
    x = '0' + x if len(x)%2 != 0 else x
    lst = [x.upper()[i:i+2] for i in range(0, len(x), 2)]
    ans = []
    for i, e in enumerate(lst):
        if i%2 == 0:
            ans.append(e)
        else:
            ans.insert(0, e)
    return ''.join(ans)

def mid_endian(n):
    hex_str = hex(n)[2:].zfill(len(hex(n)[2:]) + len(hex(n)[2:]) % 2).upper()
    cut = [hex_str[i:i + 2] for i in range(0, len(hex_str) - 1, 2)]
    cut += [] if len(cut) % 2 else ['']
    return ''.join(cut[1::2][::-1] + cut[0:1] + cut[2::2])

def mid_endian(n):
    s = format(n,'x')
    s = '0' + s if len(s)%2 else s
    r,c = '',0
    while s:
        if not c%2:
            r += s[:2]
        else:
            r = s[:2] + r
        c += 1
        s = s[2:]
    return r.upper()



def mid_endian(n):
    s = '{:0X}'.format(n)
    s = '0' * (len(s) % 2) + s
    ret = ''
    for n, i in enumerate([s[i * 2: (i + 1) * 2] for i in range(len(s) // 2)]):
        ret = i + ret if n%2 == 1 else ret + i
    return ret