Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson14-diy1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
40088d31
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
f2289e9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
diy1.py
diy1.py
View file @
40088d31
def
sum_numbers
(
num
):
if
num
==
1
:
return
1
result
=
num
+
sum_numbers
(
num
-
1
)
return
result
number
=
50
res
=
sum_numbers
(
number
)
print
(
"1到"
+
str
(
number
)
+
"和是:"
+
str
(
res
))
\ No newline at end of file
1
x
1
d
1
d
1
x
2
d
1
x
3
d
2
x
5
d
3
x
8
d
5
x
13
d
8
x
21
d
13
x
34
d
21
x
55
d
34
x
89
d
55
x
144
d
89
x
223
d
144
x
367
d
223
x
589
d
367
x
956
d
589
x
1545
d
956
x
2501
d
1545
x
4046
d
2501
x
6547
d
4046
x
10593
d
6547
x
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment