Given a long number, return all the possible sum of two digits of it.

For example, `12345`: all possible sum of two digits from that number are:

    [ 1 + 2, 1 + 3, 1 + 4, 1 + 5, 2 + 3, 2 + 4, 2 + 5, 3 + 4, 3 + 5, 4 + 5 ]

Therefore the result must be:

    [ 3, 4, 5, 6, 5, 6, 7, 7, 8, 9 ]

Difficulty: introductory

Starter code:

def digits(num):
	

Solutions:
from itertools import combinations

def digits(num):
    return list(map(sum, combinations(map(int,str(num)),2)))

# Solution 1
def digits(num):
    return [int(a)+int(b) for i,a in enumerate(str(num)) for b in str(num)[(i+1):]]
    
    
# Solution 2
def digits(num):
    from itertools import combinations
    return [int(a)+int(b) for a,b in combinations(str(num), 2)]

from itertools import combinations

def digits(num):
    return [int(a) + int(b) for a, b in combinations(str(num), 2)]

from itertools import combinations

def digits(num):
    return [sum(pair) for pair in combinations([int(d) for d in str(num)], 2)]


from itertools import combinations

def digits(num):
    ns = list(map(int, str(num)))
    return [a+b for a, b in combinations(ns, 2)]

def digits(num):
    num = str(num)
    return [int(x)+int(y) for n, x in enumerate(num,1) for y in num[n:]]


def digits(num):
  return [int(x)+int(y) for i, x in enumerate(str(num)) for j, y in enumerate(str(num)) if j > i]

def digits(num):
    ints = [int(i) for i in str(num)]
    sums = []
    for i in range(len(ints)-1):
        for j in ints[i+1:]:
            sums.append(ints[i] + j)
    return sums

from itertools import combinations

def digits(num):
    lst = list(map(int, str(num)))
    return [a + b for a, b in combinations(lst, 2)]

def digits(num):
    parse = lambda s: [int(s[0]) + int(x) for x in s[1:]] + (digits(s[1:]) if len(s) > 2 else [])
    return parse(str(num))