In another Kata I came across a weird `sort` function to implement. We had to sort characters as usual ( 'A' before 'Z' and 'Z' before 'a' ) except that the `numbers` had to be sorted **after** the `letters` ( '0' after 'z') !!!

(After a couple of hours trying to solve this unusual-sorting-kata I discovered final tests used **usual** sort (digits  **before** letters :-)

So, the `unusualSort/unusual_sort` function you'll have to code will sort `letters` as usual, but will put `digits` (or one-digit-long `numbers` ) **after** `letters`.

## Examples
```python
unusual_sort(["a","z","b"])  # -> ["a","b","z"]  as usual
unusual_sort(["a","Z","B"])  # -> ["B","Z","a"]  as usual

//... but ...
unusual_sort(["1","z","a"])  # -> ["a","z","1"]
unusual_sort(["1","Z","a"])  # -> ["Z","a","1"]
unusual_sort([3,2,1"a","z","b"])  # -> ["a","b","z",1,2,3]
unusual_sort([3,"2",1,"a","c","b"])  # -> ["a","b","c",1,"2",3]
```
**Note**: `digits` will be sorted **after** "`same-digit-numbers`", eg: `1` is before `"1"`, `"2"` after `2`.
```python
unusual_sort([3,"2",1,"1","3",2])  # -> [1,"1",2,"2",3,"3"]
```

You may assume that **argument** will always be an `array/list` of **characters** or **one-digit-long numbers**.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Sorting

Data structures

Starter code: def unusual_sort(array):
	

Solutions:
def unusual_sort(array):
	return sorted(array, key=lambda x: (str(x).isdigit(), str(x), -isinstance(x, int)))


def unusual_sort(array):
	return sorted(array, key=lambda item: (str(item).isdigit(), str(item), isinstance(item, str)))


import string

def unusual_sort(array):
	upper = sorted([i for i in array if i in list(string.ascii_uppercase)])
	lower = sorted([it for it in array if it in list(string.ascii_lowercase)])
	intint = sorted([num for num in array if num in list(map(int, list(string.digits)))])
	strints = sorted([e for e in array if e in list(string.digits)])
	upper.extend(lower)
	intint.extend(strints)
	want = []
	for i in intint:
		if type(i) is not int:
			want.append((int(i), i))
		else:
			want.append((i, i))
	ans = [i[1] for i in sorted(want, key=lambda x: x[0])]
	upper.extend(ans)
	return upper


def unusual_sort(array):
	int_list = []
	digit_list = []
	char_list = []
	for x in array:
		if type(x) is str:
			if x.isdigit():
				digit_list.append(x)
			else:
				char_list.append(x)
		else:
			int_list.append(x)
	int_list.sort()
	digit_list.sort()
	char_list.sort()
	for idx in range(len(int_list)):
		for i in range(len(digit_list)):
			if int_list[idx] <= int(digit_list[i]):
				digit_list.insert(i, int_list[idx])
				break
		else:
			digit_list += int_list[idx:]
			break
	return char_list + digit_list


def unusual_sort(array):

	def k(x):
		if type(x) == int:
			return ord('z') + 1 + 10 * x
		elif x.isdigit():
			return ord('z') + 1 + 10 * int(x) + 1
		else:
			return ord(x)
	return sorted(array, key=k)


def unusual_sort(array):
	_isdigit = lambda d: type(d) == int or (type(d) == str and d.isdigit())
	digits = [d for d in array if _isdigit(d)]
	nondigits = [n for n in array if not _isdigit(n)]
	digits.sort(key=lambda d: int(d) if type(d) == str else d - 0.1)
	nondigits.sort()
	return nondigits + digits