반복문으로도 풀 수 있다.
def factorial(n: int) -> int:
if n == 0:
return 1
return n * factorial(n-1)
N = int(input())
print( factorial(N) )
https://ko.wikipedia.org/wiki/계승
def fibo(n: int) -> int:
if n == 0:
return 0
if n == 1:
return 1
return fibo(n-1) + fibo(n-2)
n = int(input())
print( fibo(n) )
def hanoi_tower(N, a, b, c):
if N == 1:
# print('%d %d' % (a, c))
result.append([a,c])
else:
hanoi_tower(N-1, a, c, b)
# print('%d %d' % (a, c))
result.append([a,c])
hanoi_tower(N-1, b, a, c)
N = int(input())
result = []
hanoi_tower(N, 1,2,3)
print(len(result))
for x, y in result:
print(x, y)