zoukankan      html  css  js  c++  java
  • Python、循环的练习 25

    复制代码
    复制代码
    from turtle import *
    fillcolor("red")
    begin_fill()
    for i in range(5):
        up()
        goto(0,-20*i)
        down()
        circle(20*i)
    end_fill()
    复制代码

    一、同心圆

    复制代码

    二、太阳花

    复制代码
    from turtle import *
    color('red','yellow')
    begin_fill()
    while True:
        forward(200)
        right(150)
        if abs(pos())<1:
            break
    end_fill()
    done()
    复制代码

    三、五星红旗

    复制代码
    
    
    复制代码
    from turtle import *
    setup(640,440,0,0)
    color("yellow")
    bgcolor("red")
    fillcolor("yellow")
      
    def llf_goto(x,y):
        up()
        goto(x,y)
        down()
         
    def llf_draw(r):
        begin_fill()
        for i in range(5):         
            forward(r)
            right(144)
        end_fill()
    
    
    llf_goto(-286,132)
    llf_draw(130)
    
    llf_goto(-132,180)
    llf_draw(50)
     
    llf_goto(-88,132)
    llf_draw(50)
     
    llf_goto(-88,72)
    llf_draw(50)
     
    llf_goto(-132,22)
    llf_draw(50)
    复制代码
    
    
    
     
    复制代码

     四、画菱形花

    复制代码
    import turtle
    
    def draw_1(llf):
        llf.forward(100)
        llf.right(45)
        llf.forward(100)
        llf.right(135)
    
    def draw_2():
        window=turtle.Screen()
        window.bgcolor("blue")
        llf=turtle.Turtle()
        llf.shape("turtle")
        llf.color("orange")
        llf.speed("fastest")
    
        for i in range(1,37):
            draw_1(llf)
            draw_1(llf)
            llf.left(10)
    
        llf.right(90)
        llf.forward(155)
        llf.color('green')
        llf.forward(145)
        window.exitonclick()
    draw_2()
    复制代码

     

  • 相关阅读:
    NKOJ P3051浇花
    Linux-Shell脚本编程-学习-2-Linux基本命令
    Linux-Shell脚本编程-学习-1-Linux基本命令
    Ubuntu下使用Git_6
    Ubuntu下使用Git_5
    电脑优化,提速
    Ubuntu下使用Git_4
    Ubuntu下使用Git_3
    Ubuntu下使用Git_2
    Ubuntu下使用Git_1
  • 原文地址:https://www.cnblogs.com/kinoko/p/7684982.html
Copyright © 2011-2022 走看看