We define the score of permutations of combinations, of an integer number (the function to obtain this value:```sc_perm_comb```) as the total sum of all the numbers obtained from the permutations of all the possible combinations of its digits.
For example we have the number 348.
```python
sc_perm_comb(348) = 3 + 4 + 8 + 34 + 38 + 48 + 43 + 83 + 84 + 348 + 384 + 834 + 843 + 438 + 483  = 3675
```
If the number has a digit 0, the numbers formed by a leading 0 should be discarded:
```python
sc_perm_comb(340) = 3 + 4 + 34 + 30 + 40 + 43 + 340 + 304 + 430 + 403 = 1631
```
If the number has digits that occur more than once, the score the adden will not be taken than twice or more:
```python
sc_perm_comb(333) = 3 + 33 + 333 = 369
```
If the number has only one digit its score is the same number:
```python
sc_perm_comb(6) = 6
sc_perm_comb(0) = 0
```

Enjoy it!!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Combinatorics

Mathematics

Starter code: def sc_perm_comb(num):
	

Solutions:
from itertools import permutations

def sc_perm_comb(num):
	sNum = str(num)
	return sum({int(''.join(p)) for d in range(1, len(sNum) + 1) for p in permutations(sNum, d)})


import itertools

def getAllCombinations(numStr, numDigits):
	combedDigits = []
	for d in range(1, numDigits + 1):
		numList = [''.join(p) for p in itertools.combinations(numStr, d)]
		uniqueNumList = set(numList)
		combedDigits.append(uniqueNumList)
	return combedDigits

def sc_perm_comb(n):
	numStr = str(n)
	numDigits = len(numStr)
	combStrList = getAllCombinations(numStr, numDigits)
	permSet = set()
	for numsOfDigitD in combStrList:
		for num in numsOfDigitD:
			allPerms = [int(''.join(p)) for p in itertools.permutations(num) if p[0] != '0']
			permSet.update(set(allPerms))
	totalSum = sum(permSet)
	return totalSum


import itertools

def sc_perm_comb(num):
	return sum([int(''.join(p)) for i in range(1, len(str(num)) + 1) for p in set(itertools.permutations(str(num), i)) if p[0] != '0'])


import itertools

def sc_perm_comb(num):
	total = 0
	for k in range(1, len(str(num)) + 1):
		t = set(itertools.permutations(str(num), k))
		for l in t:
			temp = ''.join(l)
			if temp[0:1] != '0':
				total += int(temp)
	return total


sc_perm_comb = lambda n: sum({int(''.join(p)) for r in range(len(str(n))) for p in __import__('itertools').permutations(str(n), r + 1)})


from itertools import permutations

def sc_perm_comb(num):
	s = str(num)
	return sum({int(''.join(p)) for (c, _) in enumerate(s, 1) for p in permutations(s, c)})


import itertools

def sc_perm_comb(num):
	line = []
	for i in range(len(str(num))):
		line += [int(''.join(n)) for n in itertools.permutations(list(str(num)), i + 1)]
	return sum(set(line))