You have been speeding on a motorway and a police car had to stop you. The policeman is a funny guy that likes to play games. Before issuing penalty charge notice he gives you a choice to change your penalty. 

Your penalty charge is a combination of numbers like: speed of your car, speed limit in the area, speed of the police car chasing you, the number of police cars involved, etc.  So, your task is to combine the given numbers and make the penalty charge to be as small as possible.      

For example, if  you are given numbers  ```[45, 30, 50, 1]``` your best choice is ```1304550```


Examples:
```Python
['45', '30', '50', '1'] => '1304550'

['100', '10', '1'] => '100101'

['32', '3'] => '323'
```

Difficulty: introductory

Starter code:

def penalty(a_list):
	

Solutions:
def penalty(lst):
    lst, maxLen = list(map(str, lst)), max(map(len, lst))
    return ''.join(sorted(lst, key=lambda s: s.ljust(maxLen, s[-1])))

#return str of the smallest value of the combined numbers in a_list
def penalty(a_list):
  return ''.join(sorted(a_list, key = lambda n: n + n[:1]))

penalty=lambda a:''.join(sorted(a,key=lambda n:2*n))

def penalty(a_list):
    for i in range(len(a_list)):
        for j in range(i+1,len(a_list)):
            a,b = a_list[i],a_list[j]
            if int(a+b) >= int(b+a):
                a_list[i],a_list[j] = b,a
    s = ""
    for k in a_list:
        s += k
    return s

import functools

def penalty(lis):
    custom = lambda i, j: -1 if str(j) + str(i) > str(i) + str(j) else 1
    res = sorted(lis, key=functools.cmp_to_key(custom))
    return "".join(map(str, res))

def penalty(nos):
    print(nos)
    pos = 0
    ret = []
    for x in range(len(nos)):
        low = 10
        tmp = ''
        for x in nos:
            if int(x[0])<=int(low):
                if tmp != '':
                    tmp = getLowest(tmp,x)
                else:
                    tmp = x
                low = tmp[0]
        ret.append(tmp)
        #print(ret,'\t',tmp)
        nos.remove(tmp)
    return ''.join(ret)
        
def getLowest(s1,s2):
    res = {s1:s1,s2:s2}
    if len(s2)<len(s1):
        res[s2] = equalPad(s2,len(s1))
    elif len(s2)>len(s1):
        res[s1] = equalPad(s1,len(s2))
    #print('res',res)
    for x in range(len(res[s1])):
        if res[s1][x] < res[s2][x]:
            return s1
        elif res[s2][x] < res[s1][x]:
            return s2
    return s1

def equalPad(s0,w):
    return s0.ljust(w,s0[-1])

def penalty(p):
    n = len(max(p, key=int))
    return ''.join(sorted(p, key=lambda x: (x.ljust(n, x[-1]), -len(x))))

def penalty(a_list):
    return ''.join(sorted(a_list,key=lambda x:x*10))

from functools import cmp_to_key

def cmp_func(a, b):
    ab, ba = (a + b), (b + a)
    return (ab > ba) - (ab < ba)


def penalty(l):
    return ''.join(sorted(l, key=cmp_to_key(cmp_func)))