day03作业

变量的组成

1.变量由数字、下划线、字母组成的变量

2.变量赋值符号 =

3.变量值

变量的名命名规范

变量名不能以数字开头,且由数字、下划线、字母组成

且不能使用Python的关键字作为变量名

变量名应为变量所描述的状态,不可为中文表示

注释的作用

注释起到提示的作用,让代码更加易懂清晰,让代码变为普通字符

turtle库构造出的图片

import turtle
turtle.hideturtle()
#摆出画板
turtle.setup()
turtle.pencolor('black')
turtle.pensize(4)
#移动光标位置
turtle.penup()
turtle.goto(-200,30)
turtle.down()
#开始画
turtle.fillcolor('gray')
turtle.begin_fill()
turtle.circle(40,360)
turtle.end_fill()
turtle.circle(40,180)
#画第一个把柄
turtle.goto(10,150)
turtle.circle(10,-50)
#移动画直线
turtle.penup()
turtle.goto(-160,60)
turtle.pendown()
turtle.goto(-100,60)
turtle.seth(90)
#画第二个圆圈
turtle.penup()
turtle.goto(-20,60)
turtle.pendown()
#开始画圆
turtle.fillcolor('gray')
turtle.begin_fill()
turtle.circle(40,360)
turtle.end_fill()
#将光标移动到第二个眼睛把柄起始位置
turtle.penup()
turtle.circle(40,30)

turtle.pendown()
turtle.goto(150,125)
# turtle.seth(1)
turtle.circle(20,-80)
turtle.penup()


turtle.goto(-200,-100)
turtle.pendown()
turtle.seth(0)
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.circle(30,360)
turtle.end_fill()

turtle.penup()
turtle.goto(-200,-90)
turtle.pendown()

turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(20,350)
turtle.end_fill()
turtle.done()
posted @ 2019-08-23 16:36  小凯子+  阅读(100)  评论(0编辑  收藏  举报