Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / level3-lesson14-diy2

  • This project
    • Loading...
  • Sign in
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 3557f308 authored 2 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent 95f39761 c276685l1515p256a14883/wx039816
Show whitespace changes
Inline Side-by-side
Showing with 84 additions and 14 deletions
  • diy2.py
  • diy3.py
  • diy4.py
  • diy5.py
  • diy6.py
  • diy7.py
  • diy8.py
diy2.py
View file @ 3557f308
# 尝试编写func()函数输出斐波那契数列的第十五个数是什么?
# 斐波那契数列:1,1,2,3,5,8,13,21,34,55……
from time import time
start_time = time()
def func(n):
if n<=2:
return 1
a = func(n-1)+func(n-2)
return a
print(func(39))
end_time=time()
result = end_time - start_time
print("总耗时:",result)
#调用函数并打印结果
r=input("圆的半径:")
R=2*r
P=3.14
L=2*P*r
area=P*r*r
print("圆的直径:",round(2,R))
print("圆的周长:",round(2,L))
print("圆的面积:",round(2,area))
This diff is collapsed. Click to expand it.
diy3.py 0 → 100644
View file @ 3557f308
import turtle
turtle.penup()
turtle.goto(0,-200)
turtle.pendown()
turtle.circle(200)
turtle.penup()
turtle.goto(-100,50)
turtle.pendown()
turtle.fillcolor('blue')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
This diff is collapsed. Click to expand it.
diy4.py 0 → 100644
View file @ 3557f308
import turtle
turtle.goto(-100,100)
turtle.forward(200)
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(200)
turtle.goto(0,0)
turtle.pendown()
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.done()
This diff is collapsed. Click to expand it.
diy5.py 0 → 100644
View file @ 3557f308
import turtle
turtle.penup()
turtle.goto(-100,100)
turtle.pendown()
turtle.forward(200)
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(200)
turtle.penup()
turtle.goto(100,0)
turtle.pendown()
turtle.begin_fill()
turtle.circle(100,steps=4)
turtle.fillcolor("red")
turtle.end_fill()
turtle.hideturtle()
turtle.done()
\ No newline at end of file
This diff is collapsed. Click to expand it.
diy6.py 0 → 100644
View file @ 3557f308
a=input("请输入乌龟爬行的速度:")
v=int(a)
b=100/v
print("乌龟能够追上兔子所需的时间是:",b,"秒。")
\ No newline at end of file
This diff is collapsed. Click to expand it.
diy7.py 0 → 100644
View file @ 3557f308
import turtle
turtle.circle(40)
turtle.penup()
turtle.goto(0,80)
turtle.pendown()
turtle.circle(40)
turtle.penup()
turtle.goto(80,80)
turtle.pendown()
turtle.circle(40)
turtle.penup()
turtle.goto(80,0)
turtle.pendown()
turtle.circle(40)
turtle.done()
\ No newline at end of file
This diff is collapsed. Click to expand it.
diy8.py 0 → 100644
View file @ 3557f308
a=input("爸爸的身高:")
b=input("妈妈的身高:")
c=input("性别系数:")
z=(a+b*c)/2
print("孩子未来的身高:",z)
\ No newline at end of file
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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