Implement 7 with recursion!

def calc(n,count): 
# print(n,count)
if count <8:
return calc(n*count,count+1)
else:
return n
b = calc(1,2)
print(b)

reuse calc function, and pass the result of each calculation into the calc function
to get the result 5040

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324729855&siteId=291194637