首页 > 其他分享 >实验6

实验6

时间:2023-06-07 22:57:36浏览次数:31  
标签:begin end move pencolor 120 实验 fill

5:

 1 from turtle import *
 2 
 3 def move(x,y):
 4     penup()
 5     goto(x,y)
 6     pendown()
 7 
 8 
 9 move(-100,0)
10 begin_fill()
11 for i in range(4):
12     fd(200)
13     left(90)
14 end_fill()
15 
16 move(0,0)
17 begin_fill()
18 pencolor('red')
19 fillcolor('red')
20 left(45)
21 for i in range(4):
22     fd(100*2**0.5)
23     left(90)
24 end_fill()
25 
26 hideturtle()
27 done()

截图:

5-2:

 1 from turtle import *
 2 
 3 def move(x,y):
 4     penup()
 5     goto(x,y)
 6     pendown()
 7 
 8 
 9 pensize(2)
10 pencolor('blue')
11 speed(0)
12 
13 r = 40
14 move(0,-r)
15 for i in range(5):
16     circle(r)
17     r+=20
18     move(0,-r)
19 
20 move(-120,0)
21 begin_fill()
22 fillcolor('white')
23 pencolor('white')
24 for i in range(4):
25     fd(120)
26     left(90)
27 end_fill()
28 
29 move(-120,-120)
30 begin_fill()
31 fillcolor('white')
32 pencolor('white')
33 for i in range(4):
34     fd(120)
35     left(90)
36 end_fill()
37 
38 move(0,-120)
39 begin_fill()
40 fillcolor('white')
41 pencolor('white')
42 for i in range(4):
43     fd(120)
44     left(90)
45 end_fill()
46 
47 pencolor('blue')
48 move(0,0)
49 fd(120)
50 move(0,0)
51 left(90)
52 fd(120)
53 
54 
55 hideturtle()
56 done()

截图:

6:

 1 from turtle import *
 2 
 3 setup(800,600)
 4 speed(0)
 5 
 6 def move(x,y):
 7     penup()
 8     goto(x,y)
 9     pendown()
10 
11 bgcolor('black')
12 
13 move(0,-100)
14 pencolor('yellow')
15 fillcolor('yellow')
16 begin_fill()
17 circle(100)
18 end_fill()
19 
20 pencolor('black')
21 move(0,0)
22 begin_fill()
23 fillcolor('black')
24 right(45)
25 for i in range(4):
26     fd(100)
27     left(90)
28 
29 move(0,50)
30 circle(16)
31 end_fill()
32 
33 pencolor('white')
34 fillcolor('white')
35 begin_fill()
36 move(-4*2**0.5,50+4*2**0.5)
37 circle(4)
38 end_fill()
39 
40 hideturtle()
41 done()

截图:

 

标签:begin,end,move,pencolor,120,实验,fill
From: https://www.cnblogs.com/kuma-ja/p/17462950.html

相关文章

  • 实验二 最速下降法程序设计
    一、实验目的通过最速下降法的程序设计,为今后的约束优化方法的学习和编程奠定基础;掌握负梯度方向的定义和最速下降法的迭代公式;通过此次实验,进一步巩固最速下降法的基本原理和思想。二、实验内容(1)求解无约束优化问题:(2)终止准则取;(3)完成最速下降法(负梯度法)的MATLAB编程、调试;(4)......
  • 实验6
    task1_1源码:fromturtleimport*defmove(x,y):'''画笔移动到坐标(x,y)处'''penup()goto(x,y)pendown()defdraw(n,size=100):'''绘制边长为size的正n变形'''foriinrange(n):......
  • 实验六 turtle绘图与Python库应用编程体验
    试验任务一实验源码 task1fromturtleimport*defmove(x,y):'''画笔移动到坐标(x,y)处'''penup()goto(x,y)pendown()defdraw(n,size=100):'''绘制边长为size的正n变形'''foriinrange(n):......
  • 实验七 面向对象编程与内置模块
    实验任务一实验源码 classAccount:'''一个模拟银行账户的简单类'''def__init__(self,name,account_number,initial_amount=10):'''构造新账户'''self._name=nameself._card_no=accoun......
  • 实验6
    task1_1.py实验源码:fromturtleimport*defmove(x,y):penup()goto(x,y)pendown()defdraw(n,size=100):foriinrange(n):fd(size)left(360/n)defmain():pensize(2)pencolor('red')move(-200,0)......
  • 恒电流间歇滴定法(GITT)测试锂离子电池的实验流程
    恒电流间歇滴定法(GITT)测试锂离子电池的实验流程锂电池作为现代电子设备中最常用的电源之一,其性能和安全性对于设备的正常运行至关重要。恒电流间歇滴定测试是一种常用的测试方法,用于评估锂电池的容量、循环寿命和内阻等关键参数。1、确定测试目的和参数:在进行恒电流间歇滴定测试之......
  • 实验7 面向对象编程与内置模块
    实验任务1classAccount:#一个模拟账户类def__init__(self,name,account_number,initial_amount=10):'''构造新账户'''self._name=nameself._card_no=account_numberself._balance=initial_amount......
  • 实验7 面向对象编程与内置模块
    实验任务1源代码1classAccount:2def__init__(self,name,account_number,initial_amount=10):3self._name=name4self._card_no=account_number5self._balance=initial_amount67defdeposit(self,amount):8sel......
  • 《大学物理实验上》期末笔记(二)有效数字特典
    《大学物理实验上》期末笔记(二)有效数字特典最头疼的一集有效数字测量值存在误差是不可避免的,因而测量值包含了准确数字和欠准数字。我们将准确数字和欠准数字总称为有效数字。在大学物理实验中,通常只取一位欠准数字,因此有效数字由若干位准确数字和一位欠准数字组成。有效数......
  • 【锐格】数据结构-实验-二叉树
    7075#include<iostream>#include<cstdio>usingnamespacestd;typedefstructTNode{chardata;structTNode*lchild,*rchild;}BiNode,*BiTree;BiTreeT;voidcreateTree(BiTree&T){charch;cin>>ch;if(ch==&#......