Given an integer, take the (mean) average of each pair of consecutive digits. Repeat this process until you have a single integer, then return that integer. e.g.

Note: if the average of two digits is not an integer, round the result **up** (e.g. the average of 8 and 9 will be 9)

## Examples

```
digitsAverage(246)  ==>  4

original: 2   4   6
           \ / \ /
1st iter:   3   5
             \ /
2nd iter:     4


digitsAverage(89)  ==>  9

original: 8   9
           \ /
1st iter:   9
```

p.s. for a bigger challenge, check out the [one line version](https://www.codewars.com/kata/one-line-task-digits-average) of this kata by myjinxin2015!

Difficulty: EASY
Starter code: def digits_average(input):
	

Solutions:
def digits_average(input):
	digits = [int(c) for c in str(input)]
	while len(digits) > 1:
		digits = [(a + b + 1) // 2 for (a, b) in zip(digits, digits[1:])]
	return digits[0]


digits_average = a = lambda n: n > 9 and a(int(''.join((str(-~int(a) + int(b) >> 1) for (a, b) in zip(str(n), str(n)[1:]))))) or n


import math

def digits_average(n):
	a = [int(i) for i in list(str(n))]
	e = [a[i:i + 2] for i in range(len(a) - 1)]
	return n if len(str(n)) == 1 else digits_average(int(''.join([str(math.ceil(sum(i) / 2)) for i in e])))


digits_average = f = lambda n: type(n) != int and (len(n) > 1 and f([-~a + b >> 1 for (a, b) in zip(n, n[1:])]) or n[0]) or f([int(e) for e in str(n)])


import math

def digits_average(input):
	m = str(input)
	for i in range(len(str(input)) - 1):
		m = ''.join((str(math.ceil(int(m[i]) / 2 + int(m[i + 1]) / 2)) for i in range(len(m) - 1)))
	return int(m)


from math import ceil

def digits_average(input):
	if input < 10:
		return input
	else:
		l = [int(i) for i in list(str(input))]
		r = [ceil(sum(i) / 2.0) for i in list(zip(l, l[1:]))]
		return r[0] if len(r) == 1 else digits_average(int(''.join([str(i) for i in r])))


from math import ceil

def digits_average(input):

	def return_average(a, b):
		return str(ceil((int(a) + int(b)) / 2))
	string_ = str(input)
	while len(string_) > 1:
		string_ = ''.join((return_average(a, b) for (a, b) in zip(string_, string_[1:])))
	return int(string_)


import math

def convert_to_list(number):
	lst = []
	while number != 0:
		lst.append(number % 10)
		number = int(number / 10)
	return lst

def list_to_list(lst):
	average_list = []
	for i in range(len(lst) - 1):
		average_list.append(math.ceil((lst[i] + lst[i + 1]) / 2))
	return average_list

def digits_average(digits):
	lst = convert_to_list(digits)
	while len(lst) > 1:
		lst = list_to_list(lst)
	return lst[0]


def digits_average(input):
	l = [int(list(str(input))[i]) for i in range(len(str(input)))]
	while len(l) != 1:
		l = [(l[i] + l[i + 1]) // 2 + (l[i] + l[i + 1]) % 2 for i in range(len(l) - 1)]
	return l[0]


import math

def digits_average(num):
	a = str(num)
	b = []
	a = [n for n in a]
	for i in a:
		b.append(int(i))
	if len(b) == 1:
		return b[0]
	while len(a) > 1:
		c = 0
		while c <= len(b) - 2:
			d = b[c] + b[c + 1]
			d = math.ceil(d / 2)
			b[c] = d
			c += 1
		del b[len(b) - 1]
		if len(b) == 1:
			return b[0]