# How to maintain the value of the variable in the field (number). Python

• I've solved the task. It needs to find a multiplicative stable, which is the number of times you have to multiply the numbers until you reach the only number. The number is 39. 3*9 = 27. 2*7 = 14. Then 1*4 = 4. And stop. 3. Only one agrarian(number) is given. Here's my code:

``````from functools import reduce
amount - total length of blocks
67 - number
['6','7']
def rec(number, *args):
summ = args
amount = 0
t1 = tuple(map(int, list(str(number))))
l1 = len(t1)
amount += l1
lst = list(summ)
lst.append(1)
if amount > 1:
result1 = reduce(lambda x, y: x * y, t1)
rec(result1, lst)
else:
return sum(list(args))
``````

• There's no other option with a double class. The significance of the variable is maintained through the positioning argument (the)`y` in this example:

``````def rec(x, y=0):
f = lambda i: i if i<10 else f(i//10) * (i%10)
return y if x<10 else rec(f(x), y+1)
rec(39)  # 3
``````

2

2

2

2

2

2

2

2

2

2

2

2

2

2

2