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
2 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
fb2ada03
Show 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
):
if
n
<=
2
:
return
1
else
:
value
=
ff
(
n
-
1
)
+
ff
(
n
-
2
)
\ No newline at end of file
# 若每个月成年生物可繁殖1对后代,那么n个月后共有多少对后代?
number
=
input
(
'请输入月数:'
)
def
ff
(
n
):
if
n
<=
2
:
return
1
else
:
value
=
ff
(
n
-
1
)
+
ff
(
n
-
2
)
return
value
func_value
=
ff
(
int
(
number
))
print
(
number
+
'个月后共有'
+
str
(
func_value
)
+
'对此生物'')
This diff is collapsed.
Click to expand it.
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
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