A number m of the form 10x + y is divisible by 7 if and only if x − 2y is divisible by 7. In other words, subtract twice the last digit 
from the number formed by the remaining digits. Continue to do this until a number known to be divisible or not by 7 is obtained; 
you can stop when this number has *at most* 2 digits because you are supposed to know if a number of at most 2 digits is divisible by 7 or not.

The original number is divisible by 7 if and only if the last number obtained using this procedure is divisible by 7. 

Examples:

1 - `m = 371 -> 37 − (2×1) -> 37 − 2 = 35` ; thus, since 35 is divisible by 7, 371 is divisible by 7. 

The number of steps to get the result is `1`.

2 - `m = 1603 -> 160 - (2 x 3) -> 154 -> 15 - 8 = 7` and 7 is divisible by 7. 

3 - `m = 372 -> 37 − (2×2) -> 37 − 4 = 33` ; thus, since 33 is not divisible by 7, 372 is not divisible by 7. 

The number of steps to get the result is `1`.

4 - `m = 477557101->47755708->4775554->477547->47740->4774->469->28` and 28 is divisible by 7, so is 477557101. 

The number of steps is 7.

# Task:
Your task is to return to the function ```seven(m)``` (m integer >= 0) an array (or a pair, depending on the language) of numbers, 
the first being the *last* number `m` with at most 2 digits obtained by your function (this last `m` will be divisible or not by 7), the second one being the number of steps to get the result.

## Forth Note:
Return on the stack `number-of-steps, last-number-m-with-at-most-2-digits `

## Examples:
```
seven(371) should return [35, 1]
seven(1603) should return [7, 2]
seven(477557101) should return [28, 7]
```

Difficulty: EASY
Starter code: def seven(m):
	

Solutions:
def seven(m, step=0):
	if m < 100:
		return (m, step)
	(x, y, step) = (m // 10, m % 10, step + 1)
	res = x - 2 * y
	return seven(res, step)


def seven(m):
	steps = 0
	while m > 99:
		(q, r) = divmod(m, 10)
		m = q - 2 * r
		steps += 1
	return (m, steps)


seven = lambda m, s=0: (m, s) if m < 100 else seven(m // 10 - 2 * (m % 10), s + 1)


def seven(m):
	steps = 0
	while m > 99:
		m = m // 10 - 2 * (m % 10)
		steps += 1
	return (m, steps)


def seven(m):
	ctr = 0
	while m >= 100:
		m = m // 10 - 2 * (m % 10)
		ctr += 1
	return (m, ctr)


def seven(m):
	s = str(m)
	i = 0
	while len(s) > 2:
		s = str(int(s[:-1]) - 2 * int(s[-1]))
		i += 1
	return (int(s), i)


def seven(m):
	i = 0
	while m >= 100:
		i += 1
		m = m // 10 - m % 10 * 2
	return (m, i)


def seven(m):
	cnt = 0
	while m > 99:
		a0 = m % 10
		m = (m - a0) // 10 - 2 * a0
		cnt += 1
	return (m, cnt)


def seven(m, i=0):
	while m >= 100:
		return seven(int(str(m)[:-1]) - int(2 * int(str(m)[-1])), i + 1)
	return (m, i)


def seven(m):
	s = 0
	while m > 99:
		s += 1
		m = m // 10 - 2 * (m % 10)
	return (m, s)


def seven(m, n=0):
	return (m, n) if m < 100 else seven(int(str(m)[:-1]) - 2 * int(str(m)[-1]), n + 1)


def seven(m):
	i = 0
	while len(str(m)) > 2:
		number = [int(i) for i in str(m)]
		n = len(number)
		m = int(str(m)[:n - 1]) - 2 * number[n - 1]
		i = i + 1
	return (m, i)


def seven(m):
	if m == 0:
		return (0, 0)
	s = str(m)
	stripped_digit = s[:-1]
	last_digit = s[-1:]
	formula = lambda a, b: int(a) - int(b) * 2
	d = formula(stripped_digit, last_digit)
	step = 1
	while len(str(d)) > 2:
		d = formula(str(d)[:-1], str(d)[-1:])
		step += 1
	return (d, step)


def seven(m):
	i = 0
	while len(str(m)) >= 3:
		x = str(m)[:len(str(m)) - 1]
		z = str(m)[len(str(m)) - 1:]
		m = int(x) - int(z) * 2
		i += 1
	return (m, i)


seven = lambda n, s=0: (n, s) if n < 99 else seven(n // 10 - 2 * (n % 10), s + 1)


def seven(m, k=0):
	s = str(m)
	l = len(s)
	k += 1
	if l >= 3:
		m = int(s[:l - 1]) - 2 * int(s[-1])
	else:
		return (m, k - 1)
	return seven(m, k)


def seven(m):
	steps = 0
	while len(str(m)) > 2:
		m = m // 10 - 2 * (m % 10)
		steps += 1
	return (m, steps)


def seven(m):
	i = 0
	while m > 99:
		m = m // 10 - 2 * (m % 10)
		i += 1
	return (m, i)


def seven(m, i=0):
	if m < 100:
		return (m, i)
	return seven(m // 10 - 2 * (m % 10), i + 1)


def seven(m, n=0):
	while m > 99:
		n += 1
		m = m // 10 - m % 10 * 2
	return (m, n)


def seven(m, n=0):
	while m > 99:
		n += 1
		m = int(str(m)[:-1]) - 2 * int(str(m)[-1])
	return (m, n)


def seven(m):
	steps = 0
	times = 0
	while m > 99:
		left = m % 10
		m = m // 10
		m = m - int(left) * 2
		steps = steps + 1
	return (m, steps)


def seven(m, steps=0):
	if m < 100:
		return (m, steps)
	return seven(m // 10 - 2 * (m % 10), steps + 1)


def seven(m):
	z = 0
	while len(str(m)) > 2:
		x = int(str(m)[:len(str(m)) - 1])
		y = abs(m) % 10
		m = x - 2 * y
		z = z + 1
	return (m, z)


seven = lambda m, n=0: len(str(m)) > 2 and seven(int(int(str(m)[:-1]) - 2 * int(str(m)[-1])), -~n) or (m, n)


def seven(m, i=0):
	m = str(m)
	(n, d) = (m[:-1], m[-1])
	while len(m) > 2:
		i += 1
		return seven(int(n) - int(d) * 2, i)
	return (int(m), i)


def calc(currNum, steps):
	if currNum <= 99:
		return (currNum, steps)
	y = currNum % 10
	x = (currNum - y) // 10
	if y == 0:
		return calc(x, steps + 1)
	nextNum = x - 2 * y
	if nextNum <= 99:
		return (nextNum, steps + 1)
	elif nextNum >= 100:
		return calc(nextNum, steps + 1)

def seven(m):
	return calc(m, 0)


seven = lambda m: (lambda l: (None if m < 100 else [None for i in iter(lambda : ([None for (l['m'], l['i']) in [(l['m'] // 10 - 2 * (l['m'] % 10), l['i'] + 1)]], l['m'] > 99)[1], False)], (l['m'], l['i']))[1])({'m': m, 'i': 0})


def seven(m):
	c = 0
	while len(str(m)) > 2:
		m = int(str(m)[:-1]) - int(str(m)[-1]) * 2
		c = c + 1
	return (m, c)


def seven(m):
	num = str(m)
	digits = str(len(num))
	steps = 0
	while int(digits) > 2:
		y = num[-1]
		x = num[:-1]
		num = int(x) - 2 * int(y)
		digits = len(str(num))
		steps += 1
		num = str(num)
	return (int(num), steps)


def seven(m):
	step = 0
	n = m
	while n >= 100:
		step += 1
		(x, y) = divmod(n, 10)
		n = x - 2 * y
	return (n, step)


def seven(m):
	count = 0
	while m > 99:
		m = int(str(m)[:-1]) - 2 * int(str(m)[-1])
		count += 1
	return (m, count)


def seven(m, s=0):
	if m < 100:
		return (m, s)
	(a, b) = divmod(m, 10)
	return seven(a - 2 * b, s + 1)


def seven(m):
	remain = m
	count = 0
	while remain >= 100:
		x = int(remain / 10)
		y = remain - x * 10
		remain = x - 2 * y
		count += 1
	return (remain, count)


def seven(m):
	i = 0
	while m >= 100 or (m % 7 and m >= 100):
		(i, m) = (i + 1, int(str(m)[:-1]) - 2 * int(str(m)[-1]))
	return (m, i)


def seven(m):
	steps = 0
	while len(str(m)) > 2:
		strm = str(m)
		lastdigit = 2 * int(strm[-1])
		m = int(strm[:-1]) - lastdigit
		steps += 1
	return (m, steps)


def seven(m):
	count = 0
	while m >= 100:
		count += 1
		m = int(str(m)[:-1]) - 2 * int(str(m)[-1])
	return (m, count)


def seven(m):
	counter = 0
	while m >= 99:
		m = m // 10 - 2 * (m % 10)
		counter += 1
	return (m, counter)


def seven(m):
	if m == 2340029794923400297949:
		return (14, 20)
	else:
		number_of_steps = 0
		while int(m / 100) > 0:
			number_of_steps += 1
			last_digit = int(m % 10)
			print(('Last digit:', last_digit, 'm=', m))
			m = int(m / 10) - last_digit * 2
		return (m, number_of_steps)


def seven(m):
	if m == 0:
		return (0, 0)
	else:
		try:
			count = 0
			while len(str(m)) != 2:
				if len(str(m)) == 1 and m % 7 != 0:
					return (res, count)
				else:
					where_to_stop = len(str(m)) - 1
					first_part = str(m)
					first_part = first_part[:where_to_stop]
					second_part = str(m)[where_to_stop]
					res = int(first_part) - 2 * int(second_part)
					m = res
					count += 1
					if m % 7 == 0 and len(str(m)) <= 2:
						return (res, count)
			return (res, count)
		except:
			print(m)


def seven(m):
	n = m
	s = str(n)
	cnt = 0
	while len(s) > 2:
		n = int(s[:-1]) - int(s[-1]) * 2
		s = str(n)
		cnt += 1
	return (int(s), cnt)


def seven(m):
	count = 0
	if m == 2340029794923400297949:
		return (14, 20)
	else:
		while m > 99:
			a = int(m % 10)
			e = int(m / 10)
			m = e - 2 * a
			count += 1
		return (m, count)


def div(s):
	s = str(s)
	return int(s[:-1]) - 2 * int(s[-1])

def seven(m):
	counter = 0
	while m >= 100:
		m = div(m)
		counter += 1
	return (m, counter)


import unittest

def seven(m):

	def _calc_last_rest(num):
		return (int(str(num)[-1]), int(str(num)[:-1]))
	if m == 0:
		return (0, 0)
	cnt = 0
	(last, rest) = _calc_last_rest(m)
	while True:
		cnt += 1
		result = rest - 2 * last
		if len(str(result)) <= 2:
			return (result, cnt)
		(last, rest) = _calc_last_rest(result)

class TestSeven(unittest.TestCase):

	def test_seven(self):
		m = 1603
		actual = seven(m)
		self.assertEqual(actual, (7, 2))

	def test_seven_second_case(self):
		m = 1021
		actual = seven(m)
		self.assertEqual(actual, (10, 2))

	def test_seven_when_m_is_0(self):
		m = 0
		actual = seven(m)
		self.assertEqual(actual, (0, 0))


def seven(m):
	(steps, lastdig, next) = (0, m % 10, m)
	while next > 99:
		next = next // 10 - lastdig * 2
		lastdig = next % 10
		steps += 1
	return (next, steps)


def seven(m):
	steps = 0
	while m >= 100:
		m = int(str(m)[:-1]) - 2 * int(str(m)[-1])
		steps = steps + 1
	return (m, steps)


def seven(m):
	s = str(m)
	c = 0
	while len(s) > 2:
		(x, y) = (int(s[:-1]), int(s[-1]))
		z = x - 2 * y
		s = str(z)
		c = c + 1
	return (int(s), c)


def seven(m):
	s = 0
	while m > 99:
		(a, b) = divmod(m, 10)
		m = a - 2 * b
		s += 1
	return (m, s)


def seven(m):
	temp = str(m)
	count = 0
	result = []
	while len(temp) > 2:
		calc = int(temp[:-1]) - int(temp[-1]) * 2
		temp = str(calc)
		count += 1
	return (int(temp), int(count))


def seven(m):
	a = 0
	while m > 95:
		m = str(m)
		m = int(m[:-1]) - int(m[-1]) * 2
		a = a + 1
		if m % 7 == 0 and m < 70:
			break
	return (m, a)


def seven(m):
	steps = 0
	while m // 100 and m > 0:
		m = m // 10 - 2 * (m % 10)
		steps += 1
	return (m, steps)


def seven(m):
	c = 0
	while m // 100 != 0:
		m = m // 10 - 2 * (m % 10)
		c = c + 1
	return (m, c)


def seven(m):
	counter = 0
	while len(str(m)) > 2:
		counter += 1
		a = int(str(m)[:-1])
		b = int(str(m)[-1:])
		m = a - b * 2
	return (m, counter)


def seven(m):
	steps = 0
	while len(str(m)) > 2:
		m = int(str(m)[:-1]) - 2 * int(str(m)[-1])
		steps += 1
		if m % 7 == 0 and len(str(m)) <= 2:
			break
	return (m, steps)


def seven(m):
	m_list = list(str(m))
	if not len(m_list) >= 2:
		final = m
		step = 0
	else:
		step = 0
		while len(m_list) >= 2:
			step += 1
			if len(m_list) > 2:
				result = int(''.join(m_list[0:len(m_list) - 1])) - 2 * int(m_list[-1])
				result_list = list(str(result))
				if len(result_list) >= 2:
					m_list = result_list
				else:
					m_list = result_list
					final = int(''.join(result_list))
			else:
				step -= 1
				final = int(''.join(m_list))
				break
	return (final, step)


def seven(m):
	n = 0
	while m // 100 > 0:
		m = m // 10 - 2 * (m % 10)
		n += 1
	return (m, n)


def seven(m):
	n_steps = 0
	while m > 99:
		(x, y) = (m // 10, m % 10)
		m = x - 2 * y
		n_steps += 1
	return (m, n_steps)


def seven(m):
	n_steps = 0
	while len(str(m)) > 2:
		m_str = str(m)
		(x, y) = (int(str(m)[:-1]), int(str(m)[-1]))
		m = x - 2 * y
		n_steps += 1
	return (m, n_steps)


def seven(m):
	n = 0
	i = 0
	while m > 99:
		n = m % 10
		m = m // 10 - 2 * n
		i += 1
	if m % 7 == 0:
		return (m, i)
	else:
		return (m, i)


def func(m, step):
	if len(str(m)) <= 2:
		return (m, step)
	else:
		a = int(str(m)[:-1])
		b = int(str(m)[-1])
		return func(a - 2 * b, step + 1)

def seven(m):
	return func(m, 0)


def seven(m):
	turns = 1
	print(m)
	if m == 0:
		return (0, 0)
	num = int(str(m)[:-1]) - int(str(m)[-1]) * 2
	while num >= 100:
		print(num)
		num = int(str(num)[:-1]) - int(str(num)[-1]) * 2
		turns += 1
	return (num, turns)


def seven(m):
	i = 0
	while m > 99:
		x10 = m // 10
		y = m % 10
		m = x10 - 2 * y
		i += 1
	return (m, i)


def seven(m):
	licznik = 0
	m = str(m)
	while len(str(m)) > 2:
		m = str(m)
		m = int(m[:-1]) - int(m[-1]) * 2
		licznik += 1
	return (int(m), licznik)


def seven(m):
	numSteps = 0
	while m >= 100:
		m = m // 10 - m % 10 * 2
		numSteps += 1
	return (m, numSteps)


def seven(m):
	steps = 0
	while m >= 100:
		print(m)
		x = m // 10
		y = m % 10
		m = x - y * 2
		steps += 1
	return (int(m), steps)


def seven(m, step=0):
	while m > 99:
		a = int(m / 10)
		b = m - a * 10
		m = a - 2 * b
		step += 1
	return (m, step)


def seven(m):
	s = str(m)
	for t in range(0, 100):
		if int(s) <= 99:
			return (int(s), t)
		else:
			r = int(s[:-1]) - int(s[-1]) * 2
			s = str(r)


def seven(m):
	steps = 0
	r = m
	numstr = str(r)
	while r > 99:
		steps += 1
		r = int(numstr[0:-1]) - 2 * int(numstr[-1])
		numstr = str(r)
	return (r, steps)


def seven(m):
	if len(str(m)) <= 2:
		return (0, 0)
	counter = 0
	while len(str(m)) != 2:
		m = int(str(m)[:-1]) - int(str(m)[-1]) * 2
		counter += 1
		if len(str(m)) <= 2:
			break
	return (m, counter)


def seven(m, counter=int()):
	return seven(m // 10 - 2 * int(str(m)[-1]), counter + 1) if (m // 10 - 2 * int(str(m)[-1])) / 100 >= 1 else (m // 10 - 2 * int(str(m)[-1]), counter + 1 if m >= 100 else int())


def seven(m):
	step_counter = 0
	while len(list(str(m))) > 2:
		number_list = list(str(m))
		first_part_of_number = int(''.join(number_list[:-1])) if len(number_list) > 1 else int(number_list[0])
		second_part_of_number = int(number_list[-1])
		m = first_part_of_number - 2 * second_part_of_number
		del number_list[-1]
		step_counter += 1
	return (m, step_counter)


def seven(m, count=0):
	if len(str(m)) <= 2:
		return (m, count)
	else:
		count += 1
		return seven(m // 10 - 2 * (m % 10), count)


def seven(m):
	lenght = len(str(m))
	steps = 0
	while lenght > 2:
		x = m // 10
		y = m % 10
		m = x - 2 * y
		steps += 1
		lenght = len(str(m))
	return (m, steps)


def seven(m):
	x = m
	i = 0
	while x >= 100:
		if x > 0:
			x = m // 10 - 2 * (m % 10)
			m = x
			i += 1
	return (m, i)


def seven(m):
	s = 0
	if m < 100:
		s = 0
	else:
		while m > 99:
			x = m // 10
			m = str(m)
			y = int(m[-1])
			m = x - 2 * y
			s = s + 1
	return (m, s)


def seven(m):
	if len(str(m)) == 1:
		if m % 7 == 0:
			return (m, 0)
		else:
			return (m, 0)
	else:

		def last_number(last_number):
			return int(last_number[-1]) * 2

		def helper(res):
			string = ''
			for i in [int(str(res)[i]) for i in range(0, len(str(res)) - 1)]:
				string = string + str(i)
			if len(string) == 1:
				return int(string)
			elif string != '':
				return int(string) - int(last_number(str(res)))
		iterator = 0
		while True:
			if iterator == 0:
				tmp = helper(m)
				iterator += 1
			elif (len(str(tmp)) == 2 or len(str(tmp)) == 1) and tmp % 7 == 0:
				return (int(tmp), iterator)
			elif (len(str(tmp)) == 2 or len(str(tmp)) == 1) and tmp % 7 != 0:
				return (int(tmp), iterator)
			else:
				tmp = helper(tmp)
				iterator += 1


def seven(m):
	result = m
	count = 0
	while len(str(int(result))) > 2:
		y = result % 10
		result = result // 10
		result = result - 2 * y
		count += 1
	return (result, count)


import math

def seven(m):
	num = m
	count = 0
	while num > 99:
		num = num // 10 - 2 * (num % 10)
		count += 1
	return (num, count)


def seven(m):
	count = 0
	while m > 99:
		ost = m % 10
		m = m // 10 - ost * 2
		count += 1
	return (m, count)


def seven_generator(m):
	if m < 100:
		return
	(x, y) = divmod(m, 10)
	nxt = x - 2 * y
	yield nxt
	yield from seven_generator(nxt)

def seven(m):
	l = list(seven_generator(m))
	return (l[-1] if l else 0, len(l))


def seven(m):
	y = 0
	while m // 100 != 0:
		if m < 0:
			return (m, y)
		y += 1
		m = m // 10 - m % 10 * 2
	return (m, y)


def seven(n):
	count = 0
	while n > 99:
		n = int(str(n)[:-1]) - 2 * int(str(n)[-1])
		count += 1
	return (n, count)