At the start of each season, every player in a football team is assigned their own unique squad number. Due to superstition or their history certain numbers are more desirable than others.

Write a function generateNumber() that takes two arguments, an array of the current squad numbers (squad) and the new player's desired number (n). If the new player's desired number is not already taken, return n, else if the desired number can be formed by adding two digits between 1 and 9, return the number formed by joining these two digits together. E.g. If 2 is taken, return 11 because 1 + 1 = 2. Otherwise return null. 

Note: Often there will be several different ways to form a replacement number. In these cases the number with lowest first digit should be given priority. E.g. If n = 15, but squad already contains 15, return 69, not 78.

Source: codewars | Difficulty: EASY

Starter code: def generate_number(squad, n):
	

Solutions:
def generate_number(squad, n):
	if n not in squad:
		return n
	for i in range(1, 10):
		for j in range(1, 10):
			if i + j == n and i * 10 + j not in squad:
				return i * 10 + j


def generate_number(lst, n):
	lst = set(lst)
	return n if n not in lst else next((9 * d + n for d in range(1, 10) if 0 < n - d < 10 and 9 * d + n not in lst), None)


def generate_number(squad, n):
	candidates = [n] + [(n - d) * 10 + d for d in range(9, 0, -1)]
	for x in candidates:
		if x < 100 and x not in squad:
			return x


def generate_number(squad, n):
	(l, d) = (n - 1, 9 + n) if n < 11 else (19 - n, n * 10 - 81)
	return next((d + i * 9 for i in range(l) if d + i * 9 not in squad), None) if n in squad else n


def generate_number(squad, n):
	if n not in squad:
		return n
	for i in range(1, 10):
		for j in range(1, 10):
			if i + j == n:
				x = int(f'{i}{j}')
				if x not in squad:
					return x


def generate_number(squad, n):
	(x, squad) = (n, set(squad))
	for d in range(1, 10):
		if x not in squad:
			return x
		if 0 < n - d < 10:
			x = 9 * d + n
	if x not in squad:
		return x


def generate_number(squad, n):
	return n if n not in squad else None if n < 10 else next((x for x in range(10, 100) if sum((int(c) for c in str(x))) == n and x not in squad), None)


import itertools

def twodigcombs(n):
	ls = []
	digits = [1, 2, 3, 4, 5, 6, 7, 8, 9]
	for (x, y) in itertools.combinations_with_replacement(digits, 2):
		if x + y == n:
			ls.append([x, y])
	return sorted(ls)

def generate_number(squad, n):
	print((squad, n))
	if n not in squad:
		return n
	for [a, b] in twodigcombs(n):
		x = a * 10 + b
		if x not in squad:
			return x


def generate_number(squad, n):
	if n not in squad:
		return n
	print((squad, n))
	for i in range(0, 10):
		b = i * 10 + n - i if n - i < 10 and n - i > 0 else n
		if b not in squad:
			return b
	return None


def generate_number(squad, n):
	if n not in squad:
		return n
	for i in range(n - 9, 10):
		d = int(f'{i}{n - i}')
		if d not in squad and n - i > 0:
			return d