Commit 40088d31 by BellCodeEditor

auto save

parent f2289e9e
Showing with 24 additions and 10 deletions
def sum_numbers(num): 1x
if num == 1: 1d
return 1 1d 1x
2d 1x
result = num + sum_numbers(num-1) 3d 2x
return result 5d 3x
number = 50 8d 5x
res = sum_numbers(number) 13d 8x
print("1到"+str(number)+"和是:"+str(res)) 21d 13x
\ No newline at end of file 34d 21x
55d 34x
89d 55x
144d 89x
223d 144x
367d 223x
589d 367x
956d 589x
1545d 956x
2501d 1545x
4046d 2501x
6547d 4046x
10593d 6547x
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment