码迷,mamicode.com
首页 > 编程语言 > 详细

Python基础综合练习

时间:2018-03-20 18:11:06      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:alt   done   python   hid   aws   col   got   log   fill   

import turtle

def mygoto(x, y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()

def drawBigStar(x):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(x)
        turtle.right(144)
    turtle.end_fill()

def drawStar(x):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(x)
        turtle.left(144)
    turtle.end_fill()

mygoto(-250,200)
turtle.color("red")
turtle.fillcolor("red")
turtle.begin_fill();
for i in range(2):
    turtle.forward(600)
    turtle.right(90)
    turtle.forward(400)
    turtle.right(90)
turtle.end_fill()

mygoto(-220,110)
turtle.color("yellow")
turtle.fillcolor("yellow")
turtle.begin_fill()
drawBigStar(100)
turtle.end_fill()
for i in range(4):
    x=1
    if i in[0,3]:
        x=0
    mygoto(-100+x*50,150-i*45)
    turtle.left(15-i*15)
    drawBigStar(30)
mygoto(0,0)
turtle.hideturtle()
turtle.done();
技术分享图片

 


  

Python基础综合练习

标签:alt   done   python   hid   aws   col   got   log   fill   

原文地址:https://www.cnblogs.com/932zdb/p/8610220.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!