Write a comparator for a list of phonetic words for the letters of the [greek alphabet](https://en.wikipedia.org/wiki/Greek_alphabet).

A comparator is:
> *a custom comparison function of two arguments (iterable elements) which should return a negative, zero or positive number depending on whether the first argument is considered smaller than, equal to, or larger than the second argument*

*(source: https://docs.python.org/2/library/functions.html#sorted)*

The greek alphabet is preloded for you as `greek_alphabet`:

```python
greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
```

## Examples

```python
greek_comparator('alpha', 'beta')   <  0
greek_comparator('psi', 'psi')      == 0
greek_comparator('upsilon', 'rho')  >  0
```

Difficulty: introductory

Starter code:

def greek_comparator(lhs, rhs):
	

Solutions:
def greek_comparator(lhs, rhs):
    greek_alphabet = [
        'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta',
        'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu',
        'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
        'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega']
    l = len(greek_alphabet)
    k = 0
    v = 0
    i = 0
    for i in range(l):
        if lhs == greek_alphabet[i]:
            k = i
    i += 1
    i = 0
    for i in range(l):
        if rhs == greek_alphabet[i]:
            v = i
    i += 1
    b = k - v
    return b

def greek_comparator(lhs, rhs):
    return 0 if lhs == rhs else -1 if greek_alphabet.index(lhs) < greek_alphabet.index(rhs) else 1

def greek_comparator(lhs, rhs):
    if lhs == rhs:
        return 0

    greek_alphabet = (
        'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
        'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
        'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
        'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')

    return 1 if greek_alphabet.index(lhs) > greek_alphabet.index(rhs) else -1


def greek_comparator(lhs, rhs):
    alfawita = {"alpha": 1, 
                "beta": 2, 
                "gamma": 3,
                "delta": 4,
                "epsilon": 5,
                "zeta": 6,
                "eta": 7,
                "theta": 8,
                "iota": 9,
                "kappa": 10,
                "lambda": 11,
                "mu": 12,
                "nu": 13,
                "xi": 14,
                "omicron": 15,
                "pi": 16,
                "rho": 17,
                "sigma": 18,
                "tau": 19,
                "upsilon": 20,
                "phi": 21,
                "chi": 22,
                "psi": 23,
                "omega": 24}
    return alfawita[lhs]-alfawita[rhs]

greek_alphabet = ('alpha', 
'beta', 
'gamma', 
'delta', 
'epsilon', 
'zeta', 
'eta', 
'theta', 
'iota', 
'kappa', 
'lambda', 
'mu', 
'nu', 
'xi', 
'omicron', 
'pi', 
'rho', 
'sigma', 
'tau', 
'upsilon', 
'phi', 
'chi', 
'psi', 
'omega')

def greek_comparator(lhs, rhs):
    x = greek_alphabet.index(lhs)
    y = greek_alphabet.index(rhs)
    if x < y:
        return -1
    elif x == y:
        return 0
    else:
        return 1

greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
def greek_comparator(lhs, rhs):
    # the tuple greek_alphabet is defined in the nonlocal namespace
    x = greek_alphabet.index(lhs) - greek_alphabet.index(rhs)
    return x

def greek_comparator(lhs, rhs):
    # the tuple greek_alphabet is defined in the nonlocal namespace
    if lhs == rhs:
        return 0
    if greek_alphabet.index(lhs) < greek_alphabet.index(rhs):
        return -1
    if greek_alphabet.index(lhs) > greek_alphabet.index(rhs):
        return 1

greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')

def greek_comparator(lhs, rhs):
    result = 0
    if greek_alphabet.index(lhs) > greek_alphabet.index(rhs):
        result = 1
    elif greek_alphabet.index(lhs) < greek_alphabet.index(rhs):
        result = -1
    return result

def greek_comparator(lhs, rhs):
    # the tuple greek_alphabet is defined in the nonlocal namespace
    if lhs == rhs:
        return 0
    for pair in list(enumerate(greek_alphabet)):
        if pair[1] == lhs:
            valL = pair[0]
        if pair[1] == rhs:
            valR = pair[0]
    return -1 if valL < valR else 1

def greek_comparator(lhs, rhs):
    greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')

    
    lhs = greek_alphabet.index(lhs)
    rhs = greek_alphabet.index(rhs)
    if lhs < rhs:
        return -1
    elif lhs == rhs:
        return 0
    elif lhs > rhs:
        return 1


greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta',
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu',
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')


def greek_comparator(lhs, rhs):
    # the tuple greek_alphabet is defined in the nonlocal namespace
    if greek_alphabet.index(lhs) < greek_alphabet.index(rhs):
        return -(greek_alphabet.index(rhs) - greek_alphabet.index(lhs))
    elif greek_alphabet.index(lhs) == greek_alphabet.index(rhs):
        return 0
    else:
        return greek_alphabet.index(lhs) - greek_alphabet.index(rhs)

def greek_comparator(lhs, rhs):
    greek_alphabet = (
        'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
        'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
        'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
        'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    a, b = greek_alphabet.index(lhs), greek_alphabet.index(rhs)
    if a<b: return a-b
    return a+b if a>b else 0

def greek_comparator(lhs, rhs):
    if lhs == rhs:
        return 0
    l, r = 0, 0
    for i, a in enumerate(greek_alphabet):
        if lhs == a:
            l = i
        if rhs == a:
            r = i
    return -1 if l < r else 1


def greek_comparator(lhs, rhs):
    greek = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    
    return greek.index(lhs) - greek.index(rhs)

def greek_comparator(lhs, rhs):
    ga = [
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega']
    return -1 if ga.index(lhs)<ga.index(rhs) else 0 if ga.index(lhs)==ga.index(rhs) else 1

def greek_comparator(lhs, rhs):
    # the tuple greek_alphabet is defined in the nonlocal namespace
    greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    
    dict_old=dict(enumerate(greek_alphabet))
    dict_new={value:key for key, value in dict_old.items()}
    
    if dict_new[lhs]<dict_new[rhs]:
        return -1
    elif dict_new[lhs]==dict_new[rhs]:
        return 0
    else:
        return +1

def greek_comparator(lhs, rhs):
    greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    
    return 1 if greek_alphabet.index(lhs) > greek_alphabet.index(rhs) else \
           0 if greek_alphabet.index(lhs) == greek_alphabet.index(rhs) else \
           -1

def greek_comparator(l, r):
    gt = (
        'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
        'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
        'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
        'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    return gt.index(l)- gt.index(r)

def greek_comparator(lhs, rhs):
    if lhs == rhs: 
        return 0
    a = [greek_alphabet.index(x) for x in [lhs, rhs]]
    if a[0] > a[1]:
        return 1
    else:
        return -1

def greek_comparator(l, r):
    greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    if greek_alphabet.index(l) < greek_alphabet.index(r) : 
        return -1
    elif greek_alphabet.index(l) == greek_alphabet.index(r) :
        return 0
    return 1


greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')

def greek_comparator(lhs, rhs):
    index_lhs, index_rhs = map(greek_alphabet.index, (lhs, rhs))
    return int(index_lhs > index_rhs) or -int(index_lhs < index_rhs)

def greek_comparator(lhs, rhs):
    # the tuple greek_alphabet is defined in the nonlocal namespace
    greek_alphabet = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    
    if greek_alphabet.index(lhs) > greek_alphabet.index(rhs):
        return greek_alphabet.index(lhs) - greek_alphabet.index(rhs)
    elif greek_alphabet.index(lhs) < greek_alphabet.index(rhs) :
        return greek_alphabet.index(lhs) - greek_alphabet.index(rhs)
    return 0

def greek_comparator(lhs, rhs):
    greek_alphabet = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega']
    a = greek_alphabet.index(lhs)
    b = greek_alphabet.index(rhs)
    c=a-b
    return c

def greek_comparator(lhs, rhs):
    g = (
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega')
    a = g.index(lhs)
    b = g.index(rhs)
    if a == b:
        return 0
    if a > b:
        return 1
    if a < b:
        return -1
    


def greek_comparator(lhs, rhs):
    greek_alphabet = {
        'alpha': 1,
        'beta': 2,
        'gamma': 3,
        'delta': 4,
        'epsilon': 5,
        'zeta': 6,
        'eta': 7,
        'theta': 8,
        'iota': 9,
        'kappa': 10,
        'lambda': 11,
        'mu': 12,
        'nu': 13,
        'xi': 14,
        'omicron': 15,
        'pi': 16,
        'rho': 17,
        'sigma': 18,
        'tau': 19,
        'upsilon': 20,
        'phi': 21,
        'chi': 22,
        'psi': 23,
        'omega': 24
    }
    a = greek_alphabet.get(lhs) - greek_alphabet.get(rhs)
    return a

t = [
    'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 
    'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 
    'nu', 'xi', 'omicron', 'pi', 'rho', 'sigma',
    'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega']
def greek_comparator(l, r):
    return t.index(l) - t.index(r)