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
5acce274
authored
Oct 29, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
fb2ada03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
diy1.py
diy2.py
diy1.py
View file @
5acce274
def
ff
(
n
):
# 若每个月成年生物可繁殖1对后代,那么n个月后共有多少对后代?
if
n
<=
2
:
number
=
input
(
'请输入月数:'
)
return
1
def
ff
(
n
):
else
:
if
n
<=
2
:
value
=
ff
(
n
-
1
)
+
ff
(
n
-
2
)
return
1
\ No newline at end of file
else
:
value
=
ff
(
n
-
1
)
+
ff
(
n
-
2
)
return
value
func_value
=
ff
(
int
(
number
))
print
(
number
+
'个月后共有'
+
str
(
func_value
)
+
'对此生物'')
diy2.py
0 → 100644
View file @
5acce274
import
turtle
pen
=
turtle
.
Pen
()
pen
.
pencolor
(
'orange'
)
pen
.
pensize
(
5
)
pen
.
fillcolor
(
'red'
)
pen
.
begin_fill
()
for
i
in
range
(
6
):
for
i
in
range
(
10
):
pen
.
right
(
36
)
pen
.
forward
(
100
)
for
i
in
range
(
10
):
pen
.
right
(
36
)
pen
.
forward
(
80
)
pen
.
right
(
60
)
pen
.
end_fill
()
pen
.
hideturtle
()
turtle
.
done
()
\ No newline at end of file
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