Your goal is to create a function to format a number given a template; if the number is not present, use the digits `1234567890` to fill in the spaces.

A few rules:

* the template might consist of other numbers, special characters or the like: you need to replace only alphabetical characters (both lower- and uppercase);
* if the given or default string representing the number is shorter than the template, just repeat it to fill all the spaces.

A few examples:

```python
numeric_formatter("xxx xxxxx xx","5465253289") == "546 52532 89"
numeric_formatter("xxx xxxxx xx") == "123 45678 90"
numeric_formatter("+555 aaaa bbbb", "18031978") == "+555 1803 1978"
numeric_formatter("+555 aaaa bbbb") == "+555 1234 5678"
numeric_formatter("xxxx yyyy zzzz") == "1234 5678 9012"
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def numeric_formatter(template, data='1234567890'):
	

Solutions:
from itertools import cycle

def numeric_formatter(template, data='1234567890'):
	data = cycle(data)
	return ''.join((next(data) if c.isalpha() else c for c in template))


from itertools import cycle
import re

def numeric_formatter(template, source='1234567890'):
	gen = cycle(source)
	return re.sub('[a-zA-Z]', lambda m: next(gen), template)


def numeric_formatter(template, digits='1234567890'):
	counter = 0
	formatted = ''
	for char in template:
		if counter >= len(digits):
			counter = 0
		if char.isalpha():
			formatted += digits[counter]
			counter += 1
		else:
			formatted += char
	return formatted


def numeric_formatter(temp, numb=None):
	nb = (str(i)[-1] if not numb else numb[(i - 1) % len(numb)] for i in range(1, 24))
	return ''.join((e if not e.isalpha() else next(nb) for e in temp))


def numeric_formatter(template, number='1234567890'):
	i = 0
	res = ''
	for l in template:
		if l.isalpha():
			res += number[i]
			i += 1
			if i >= len(number):
				i = 0
		else:
			res += l
	return res


def numeric_formatter(template, nums='1234567890'):
	ln = len(nums)
	lst = list(template)
	newlst = lst.copy()
	i = 0
	for (idx, char) in enumerate(lst):
		if char.isalpha():
			newlst[idx] = nums[i]
			i += 1
			i = i % ln
	return ''.join(newlst)


def numeric_formatter(template, info='1234567890'):
	pos = 0
	answer = ''
	for char in template:
		if char.isalpha():
			answer += info[pos]
			pos += 1
			if pos >= len(info):
				pos = 0
		else:
			answer += char
	return answer


def numeric_formatter(t, s='1234567890'):
	(idx, arr_t) = (0, list(t))
	for i in range(len(arr_t)):
		if arr_t[i].isalpha():
			arr_t[i] = s[idx % len(s)]
			idx += 1
	return ''.join(arr_t)


from itertools import cycle

def numeric_formatter(s, n='1234567890'):
	n = iter(cycle(n))
	return ''.join([next(n) if i.isalpha() else i for i in s])


from itertools import cycle

def numeric_formatter(template, num='1234567890'):
	digits = cycle(num)
	return ''.join((next(digits) if char.isalpha() else char for char in template))