python基础综合练习

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from turtle import *
>>> def draw(x):
    begin_fill()
    for i in range(5):
        forward(x)
        right(144)
    end_fill()

    
>>> def go_to(x,y):
    up()
    goto(x, y)
    down()

    
>>> if __name__ == "__main__":
    setup(600, 100, 0, 0)
    bgcolor('red')
    color('yellow')
    fillcolor('yellow')
    go_to(-220, 75)
    draw(100)
    for i in range(4):
        x = 1
        if i in [0,3]:
            x = 0
        go_to(-100+x*50, 150-i*40)
        left(15-i*15)
        draw(30)
    go_to(0, 0)

    
>>> hideturtle()
Traceback (most recent call last):
  File "<pyshell#29>", line 1, in <module>
    hideturtle()
  File "<string>", line 5, in hideturtle
turtle.Terminator
>>> 

posted @ 2018-03-19 10:05  090伍明航  阅读(232)  评论(0编辑  收藏  举报