day03

1.简述变量的组成

  1. 变量名:用来引用变量值,但凡需要用变量值,都要通过变量名
  2. 赋值符号:赋值
  3. 变量值:存放数据,用来记录显示世界中的某种状态

2.简述变量名的命名规范

  1. 变量的命名应该能反映变量值所描述的状态,切记不可用中文
  2. 变量名必须用字母数字下划线组合,并且变量名的第一个字符不能是数字
  3. 关键字不能声明为变量名

3.简述注释的作用

增加代码的可读性,让别人和自己都看得懂

4.使用turtle库构造一副图,贴在markdown文档中

这是啥

import turtle
#第一个园
turtle.setup(400,400,100,200)
# turtle.speed(0.5)
turtle.penup()
turtle.goto(0,40)
turtle.pendown()
turtle.circle(70,360)

#第二个园
turtle.penup()
turtle.goto(0,100)
turtle.pendown()
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(10,360)
turtle.end_fill()

#第一个扇叶
turtle.seth(-150)
turtle.fillcolor('green')
turtle.begin_fill()
turtle.circle(50,70)
turtle.seth(30)
turtle.circle(50,70)
turtle.end_fill()

#第二个扇叶
turtle.penup()
turtle.goto(5,120)
turtle.seth(45)
turtle.pendown()
turtle.fillcolor('green')
turtle.begin_fill()
turtle.circle(50,70)
turtle.seth(-135)
turtle.circle(50,70)
turtle.end_fill()

#底座
turtle.penup()
turtle.goto(0,40)
turtle.pendown()
turtle.seth(-90)
turtle.left(20)
turtle.fd(100)
turtle.penup()
turtle.goto(0,40)
turtle.pendown()
turtle.seth(-90)
turtle.right(20)
turtle.fd(100)
turtle.seth(0)
turtle.fd(75)

#还有一个园
turtle.penup()
turtle.goto(0,-40)
turtle.pendown()
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(10,360)
turtle.end_fill()
turtle.done()



posted @ 2019-08-23 16:27  风啊风啊  阅读(111)  评论(0编辑  收藏  举报