Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson12-1
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
87f5865e
authored
Apr 20, 2025
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
59dd1b81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
diy.py
j.py
diy.py
View file @
87f5865e
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
def
sum_numbers
(
num
):
f
=
open
(
r'C:\Users\Administrator\Desktop\新建文件夹\','
w
',encoding='
utf
-
8
')
if
num
==
1
:
f.write('
小兰:
12
本
\
n
')
return
1
f.write('
小丽:
11
本
\
n
')
temp
=
sum_numbers
(
num
-
1
)
f.write('
李文:
9
本
\
n
')
return
num
+
temp
f.close()
result
=
sum_numbers
(
100
)
\ No newline at end of file
print
(
result
)
j.py
0 → 100644
View file @
87f5865e
def
func
(
n
):
if
n
<=
2
:
return
1
elif
n
>
2
:
value
=
func
(
n
-
1
)
+
func
(
n
-
2
)
return
value
result
=
func
(
8
)
print
(
result
)
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