Simple enough this one - you will be given an array. The values in the array will either be numbers or strings, or a mix of both. You will not get an empty array, nor a sparse one.

Your job is to return a single array that has first the numbers sorted in ascending order, followed by the strings sorted in alphabetic order. The values must maintain their original type. 

Note that numbers written as strings are strings and must be sorted with the other strings.

Difficulty: introductory

Starter code:

def db_sort(arr):
	

Solutions:
def db_sort(arr): 
    return sorted(arr, key=lambda x: (isinstance(x,str),x))

def db_sort(arr): 
    n=[]
    s=[]
    for i in arr:
        if type(i) ==type( 'a'):
            s.append(i)
        else:
            n.append(i)
    return sorted(n)+sorted(s)

def db_sort(arr): 
    ints, strg = [], []
    for i in arr:
        ints.append(i) if type(i) == int else strg.append(i)  
    return sorted(ints) + sorted(strg)

def db_sort(xs): 
    return sorted(xs, key=lambda x: (isinstance(x, str), x))

def db_sort(xs): 
    return sorted(xs, key=lambda x: (type(x) is str, x))

def db_sort(arr): 
    return sorted(n for n in arr if type(n) is int) + sorted(s for s in arr if type(s) is str)

db_sort = lambda a: sorted(a, key=lambda x: (type(x) is str, x))

def db_sort(arr): 
    return sorted(i for i in arr if isinstance(i, int)) + sorted(i for i in arr if isinstance(i, str))

def db_sort(arr):
    n,s = [], []
    for v in arr:
        if type(v).__name__=='str': s.append(v)
        else:n.append(v)
    return sorted(n)+sorted(s)

def db_sort(arr): 
	strings,integers=[],[]
	for i in arr:
		integers.append(i) if type(i) is int else strings.append(i)
	return sorted(integers)+sorted(strings)

def db_sort(arr):
    num = []
    alpha = []
    
    for i in arr:
        if isinstance(i, int):
            num.append(int(i))
        else:
            alpha.append(i)
            
    num.sort()
    alpha.sort()
    
    return num + alpha

def db_sort(arr): 
    return sorted([x for x in arr if not(isinstance(x,str))]) + sorted([x for x in arr if isinstance(x, str)])

def db_sort(arr): 
    return sorted([x for x in arr if isinstance(x,int)]) + sorted([x for x in arr if isinstance(x,str)])

def db_sort(arr): 
    return sorted([v for v in arr if type(v) is int]) + sorted([v for v in arr if type(v) is str])

def db_sort(arr): 
    a = list('!'*arr.count('!')) if '!' in arr else []
    return sorted([x for x in arr if isinstance(x, int)]) + a + list(map(str,sorted(map(int,([x for x in arr if isinstance(x, str) and x[0] in '0123456789']))))) +  sorted([x for x in arr if isinstance(x, str) and x[0] not in '0123456789!'])


def db_sort(arr): 
    a, b = filter(lambda x:isinstance(x, str), arr), filter(lambda x:isinstance(x, int), arr)
    return sorted(b)+sorted(a)

def db_sort(arr): 
     m = sorted(arr, key=lambda x: (isinstance(x, str), x))
     return m