# Task 

**_Given_**   *a number* , **_Return_**  **_The Maximum number _**  *could be formed from the digits of the number given* . 
___
# Notes

* **_Only Natural numbers_** *passed to the function , numbers Contain digits [0:9] inclusive*

* **_Digit Duplications_** *could occur* , So also **_consider it when forming the Largest_**

____
# Input >> Output Examples:

```
maxNumber (213) ==> return (321)
```
## **_Explanation_**:

As `321` is **_The Maximum number _**  *could be formed from the digits of the number   **_213_*** . 
___

```
maxNumber (7389) ==> return (9873)
```
## **_Explanation_**:

As `9873` is **_The Maximum number _**  *could be formed from the digits of the number  **_7389_*** . 
___

```
maxNumber (63729) ==> return (97632)
```
## **_Explanation_**:

As `97632` is **_The Maximum number _**  *could be formed from the digits of the number  **_63729_*** . 
___

```
maxNumber (566797) ==> return (977665)
```
## **_Explanation_**:

As `977665` is **_The Maximum number _**  *could be formed from the digits of the number  **_566797_*** .

**_Note_** : **_Digit duplications are considered when forming the largest_** . 
___

```
maxNumber (17693284) ==> return (98764321)
```
## **_Explanation_**:
 
As `98764321` is **_The Maximum number _**  *could be formed from the digits of the number  **_17693284_*** .
___
___
___

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Source: codewars | Difficulty: EASY

Starter code: def max_number(n):
	

Solutions:
def max_number(n):
	return int(''.join(sorted(str(n), reverse=True)))


max_number = lambda n: int(''.join(sorted(str(n)))[::-1])


max_number = lambda n: int(''.join(sorted(list(str(n)), reverse=True)))


def max_number(digits):
	sorted_digits = sorted(str(digits), reverse=True)
	result = ''
	for member in sorted_digits:
		result += str(member)
	return int(result)


def max_number(num):
	return int(''.join(sorted(list(str(num)), reverse=True)))


def max_number(n, vac=''):
	lista2 = [int(a) for a in list(str(n))]
	lista2.sort(reverse=True)
	for num in lista2:
		vac += str(num)
	return int(vac)


def max_number(n):
	return int(''.join(sorted(str(n))[::-1]))


def max_number(n):
	s = list(str(n))
	s.sort()
	res = s[::-1]
	return int(''.join(res))


def max_number(n):
	digits = []
	while n:
		(n, d) = divmod(n, 10)
		digits.append(d)
	return sum((d * 10 ** i for (i, d) in enumerate(sorted(digits))))


def max_number(n):
	sorted_list = sorted(list(str(n)), reverse=True)
	return int(''.join(sorted_list))


def max_number(n):
	number = list(str(n))
	return int(''.join(sorted(number, reverse=True)))


def max_number(n):
	tmp = list(str(n))
	return int(''.join(sorted(tmp, reverse=True)))


def max_number(n):
	newList = [i for i in str(n)]
	maxList = []
	while len(newList) > 0:
		maxList.append(max(newList))
		newList.remove(max(newList))
	return int(''.join(maxList))


def max_number(n):
	count = [0 for x in range(10)]
	string = str(n)
	for i in range(len(string)):
		count[int(string[i])] = count[int(string[i])] + 1
	result = 0
	multiplier = 1
	for i in range(10):
		while count[i] > 0:
			result = result + i * multiplier
			count[i] = count[i] - 1
			multiplier = multiplier * 10
	return result


def max_number(n):
	integers = sorted([int(i) for i in str(n)])
	return sum((v * 10 ** i for (i, v) in enumerate(integers)))


def max_number(n):
	resfornow = []
	while n > 0:
		resfornow.append(n % 10)
		n = n // 10
	res = ''
	for i in reversed(sorted(resfornow)):
		res += str(i)
	return int(res)


def max_number(n):
	n_lst = [i for i in str(n)]
	n_lst.sort()
	n_lst.reverse()
	return int(''.join(n_lst))


def max_number(n):
	num = [x for x in str(n)]
	swap = True
	while swap:
		swap = False
		for i in range(len(num) - 1):
			if num[i] < num[i + 1]:
				(num[i], num[i + 1]) = (num[i + 1], num[i])
				swap = True
	output = ''
	return int(output.join(num))


def max_number(num):
	n = list(str(num))
	sort_n = sorted(n)
	return int(''.join(sort_n[::-1]))


def max_number(n):
	lista = [int(i) for i in str(n)]
	lista.sort(reverse=True)
	string = [str(i) for i in lista]
	result = int(''.join(string))
	return result


def max_number(n):
	s = sorted(str(n))
	st = ''.join(s)[::-1]
	return int(st)


def max_number(n):
	l = []
	for (pos, digit) in enumerate(str(n)):
		l.append(digit)
	return int(''.join(sorted(l, reverse=True)))


def max_number(n):
	r = sorted(list(str(n)))[::-1]
	k = ''.join(r)
	return int(k)


from itertools import permutations

def max_number(n):
	answer = []
	max_combo = max(list(permutations([int(i) for i in str(n)])))
	for x in max_combo:
		if x not in answer:
			answer.append(str(x))
	return int(''.join(answer))


def max_number(n):
	return int(''.join([i for i in sorted(list(str(n)))[::-1]]))


def max_number(n):
	digits = str(n)
	digits_arr = []
	largest = ''
	for i in range(len(digits)):
		digits_arr.append(int(digits[i]))
	sorted_arr = sorted(digits_arr)[::-1]
	for j in range(len(sorted_arr)):
		largest += str(sorted_arr[j])
	return int(largest)


def max_number(n):
	y = sorted([x for x in str(n)])
	return int(''.join((x for x in y))[::-1])


def max_number(n):
	p = [str(i) for i in str(n)]
	p = sorted(p, reverse=True)
	p = ''.join(p)
	p = int(p)
	return p


def max_number(n):
	g = list(str(n))
	v = sorted(g, reverse=True)
	v = ''.join(v)
	return int(v)


def max_number(n):
	num = []
	num_out = ''
	n = str(n)
	for q in range(len(n)):
		num.append(n[q])
	num.sort()
	for w in num:
		num_out = num_out + w
	return int(num_out[::-1])


def max_number(n):
	arr = list(str(n))
	s = sorted(arr)[::-1]
	return int(''.join(s))


def max_number(n):
	m = list(map(int, str(n)))
	m.sort(reverse=True)
	return int(''.join((str(x) for x in m)))


def max_number(n):
	l = []
	n = str(n)
	for i in n:
		l.append(i)
	l.sort(reverse=True)
	return int(''.join(l))


from itertools import permutations

def max_number(n):
	return max([int(''.join(i)) for i in permutations(list(str(n)))])


def max_number(n):
	res = []
	for i in str(n):
		res.append(i)
	res2 = []
	for i in res:
		res2.append(int(i))
	ans = ''
	for i in sorted(res2, reverse=True):
		ans += str(i)
	return int(ans)


def max_number(n):
	n = list(map(int, str(n)))
	n = sorted(n, reverse=True)
	new_n = int(''.join(map(str, n)))
	return new_n


def max_number(n):
	array = list(str(n))
	numb = ''.join(sorted(array, reverse=True))
	s = int(numb)
	return s


def max_number(n):
	arr = list(str(n))
	result = []
	for i in arr:
		result.append(i)
	num = sorted(result)
	num.reverse()
	out = ''.join(num)
	return int(out)


def max_number(n):
	s = str(n)
	temp = []
	for c in s:
		temp.append(c)
	temp.sort(reverse=True)
	s = ''
	for t in temp:
		s += t
	print(s)
	return int(s)


def max_number(n):
	a = str(n)
	b = sorted(a, reverse=True)
	return int(''.join(b))


def max_number(n):
	num = list(str(n))
	for i in range(len(num)):
		for j in range(len(num) - i - 1):
			if num[j] < num[j + 1]:
				(num[j + 1], num[j]) = (num[j], num[j + 1])
	large = ''
	for i in num:
		large += i
	return int(large)


def max_number(n):
	a = []
	s = ''
	for i in str(n):
		a.append(int(i))
	b = sorted(a, reverse=True)
	for j in b:
		s += str(j)
	return int(s)


def max_number(n):
	st = [char for char in str(n)]
	st.sort(reverse=True)
	s = int(''.join(st))
	return s


def max_number(n):
	y = []
	for x in str(n):
		y.append(x)
	return int(''.join(sorted(y, reverse=True)))


def max_number(n):
	l = int(''.join((x for x in sorted([x for x in str(n)], reverse=True))))
	return l


def max_number(n):
	x = str(n)
	x = list(x)
	emptylist = sorted(list([int(eachletter) for eachletter in x]))
	emptylist.reverse()
	emptystring = ''
	for eachnumber in emptylist:
		emptystring = emptystring + str(eachnumber)
	return int(emptystring)


def max_number(n):
	s = ''
	a = sorted((int(i) for i in str(n)))[::-1]
	for j in a:
		s += str(j)
	return int(s)


def max_number(n):
	arrayTest = [1, 3, 2]
	array = list(str(n))
	array.sort(reverse=True)
	array1 = [str(array) for array in array]
	array2 = ''.join(array1)
	array3 = int(array2)
	return array3


def max_number(n):
	return int(''.join(map(str, sorted((int(n) for n in str(n)), reverse=True))))


def max_number(n):
	s = str(n)
	nums = []
	for i in range(len(s)):
		nums.append(int(s[i]))
	s = ''
	for i in range(len(nums)):
		for j in range(len(nums) - i - 1):
			if nums[j] <= nums[j + 1]:
				(nums[j], nums[j + 1]) = (nums[j + 1], nums[j])
	for i in nums:
		s += str(i)
	return int(s)


def max_number(n):
	x = ','.join(str(n)).split(',')
	x1 = sorted(x)
	return int(''.join(x1)[::-1])


def max_number(n):
	s = [i for i in str(n)]
	s.sort()
	return int(''.join((i for i in s[::-1])))


def max_number(n):
	k = []
	s = ''
	for i in str(n):
		k.append(i)
		k.sort(reverse=True)
	for i in k:
		s += i
	return int(s)


def max_number(n):
	output = []
	for num in str(n):
		output.append(num)
	output = ''.join(sorted(output, reverse=True))
	return int(output)


def max_number(n):
	arr = sorted(list(str(n)))
	arr_int = [int(elem) for elem in arr][::-1]
	arr_str = [str(elem) for elem in arr_int]
	result = ''.join(arr_str)
	return int(result)


def max_number(n):
	n = list(map(int, str(n)))
	n.sort(reverse=True)
	n = ''.join(map(str, n))
	return int(n)


def max_number(number):
	return int(''.join((x for x in sorted([i for i in str(number)])))[::-1])


def max_number(number):
	number_list = [x for x in str(number)]
	new_string = ''
	while number_list:
		for x in number_list:
			if x == max(number_list):
				new_string += x
				number_list.remove(x)
	return int(new_string)


def max_number(n):
	x = list(str(n))
	x.sort(reverse=True)
	return int(''.join((y for y in x)))


def max_number(n):
	leList = []
	for ele in str(n):
		leList.append(int(ele))
	leList.sort(reverse=True)
	return int(''.join((str(f'{x}') for x in leList)))


def max_number(n):
	a = [i for i in str(n)]
	a.sort(reverse=True)
	f = ''.join(a)
	z = int(f)
	return z


def max_number(n):
	sz = str(n)
	s = [char for char in sz]
	r = sorted(s, reverse=True)
	j = ''.join(r)
	return int(j)


def max_number(n):
	n = str(n)
	lista = sorted(list(n), reverse=True)
	return int(''.join(lista))


def max_number(n):
	x = sorted(list(str(n)), reverse=True)
	return int(''.join((i for i in x)))


def max_number(n):
	a = list(str(n))
	a.sort(reverse=True)
	b = ''.join(a)
	return int(b)


def max_number(n):
	newlist = str(n)
	lastlist = ''.join(sorted(newlist))[::-1]
	return int(lastlist)
max_number(566797)


def max_number(n):
	s = str(n)
	l = [int(x) for x in s]
	l = sorted(l, reverse=True)
	m = len(l) - 1
	return sum([y * 10 ** (m - i) for (i, y) in enumerate(l)])


def max_number(n):
	max_list = ''
	for x in sorted(str(n))[::-1]:
		max_list += x
	return int(max_list)


def max_number(n):
	b = list(str(n))
	c = sorted(b)
	d = c[::-1]
	x = ''.join((e for e in d))
	return int(x)


def max_number(n):
	numbers = []
	for number in str(n):
		numbers.append(number)
	numbers = sorted(numbers, reverse=True)
	numbers = ''.join(map(str, numbers))
	return int(numbers)


def max_number(n):
	d = str(n)
	q = sorted(d, reverse=True)
	w = ''.join(q)
	return int(w)


from itertools import permutations

def max_number(n):
	n = str(n)
	l = []
	l = list(permutations(n))
	max = 0
	l2 = []
	for perm in l:
		l2.append(''.join(perm))
	for i in l2:
		if max < int(i):
			max = int(i)
	return max


def max_number(n):
	n = list(str(n))
	n.sort()
	n.reverse()
	a = []
	for i in n:
		a.append(str(i))
	return int(''.join(a))


def max_number(n):
	return int(''.join(sorted([i for i in str(n)], key=None, reverse=True)))


def max_number(n):
	return int(''.join(sorted(f'{n}', reverse=True)))


def max_number(n):
	n_list = [ch for ch in str(n)]
	n_list.sort(reverse=True)
	return int(''.join(n_list))


def max_number(n):
	lst = [int(i) for i in str(n)]
	lst.sort(reverse=True)
	s = [str(i) for i in lst]
	fin = int(''.join(s))
	return fin


def max_number(n):
	lst = [num for num in str(n)]
	lst.sort(reverse=True)
	return int(''.join(lst))


def max_number(n):
	r = list(str(n))
	k = sorted(r, reverse=True)
	p = ','.join(k)
	return int(p.replace(',', ''))


def max_number(n):
	if not isinstance(n, int):
		raise TypeError("Sorry, I'm expecting an int")
	if n < 0:
		raise ValueError("Sorry, 'n' needs to be larger than 1")
	return int(''.join(sorted(list(str(n)), reverse=True)))


def max_number(n):
	a = str(n)
	b = ''
	lst = []
	for ch in a:
		lst.append(ch)
	lst.sort(reverse=True)
	for x in lst:
		b += x
	return int(b)