#!/usf/local/bin/python3 def sum(n, i=1): if n <= 0: return n print(f"count : {i}回") total = n + sum(n-1, i+1) print(f"n : {n}") print(f"n-1 : {n-1}") print(f"n + (n-1) : {total}") return total print("sum(3) =", sum(3))