• 条件、循环、函数定义练习


    1.画五角星

    import turtle
    for i in range(5):
        turtle.forward(100)
        turtle.right(144)

    2.画同心圆

    import turtle

    for i in range(5):

        turtle.circle((i+1)*10)

        turtle.up()

        turtle.goto(0,-(i+1)*10)

        turtle.down()

    3.画个太阳花

    from turtle import*

    color('red')

    fillcolor('blue')

    begin_fill()

    while True:

        forward(200)

        left(170)

        if(abs(pos()))<1:

            break

    end_fill()

    done()

    4.画五个角星

    import turtle
    turtle.color('yellow')
    turtle.bgcolor('red')
    turtle.fillcolor('yellow')

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

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

    mygoto(-320,250)
    ye(100)
    mygoto(-160,300)
    ye(25)
    mygoto(-110,250)
    ye(25)
    mygoto(-110,190)
    ye(25)
    mygoto(-160,140)
    ye(25)

  • 相关阅读:
    解析XML
    事务
    js小工具
    plsql用过的流程语句
    查询语句
    存储过程
    用过的CRT命令
    mysql常用命令
    Spirng MVC demo 完整示例01 环境搭建
    jmeter多个http请求串联
  • 原文地址:https://www.cnblogs.com/951111ldj/p/7512216.html
Copyright © 2020-2023  润新知