zoukankan      html  css  js  c++  java
  • 条件、循环、函数定义 练习

    1.

    from turtle import*
    shape('turtle')
    color('yellow')
    fillcolor('yellow')
    begin_fill()
    for i in range(5):
         forward(100)
         right(144)
    end_fill()

    2.

    from turtle import*
    shape('turtle')
    begin_fill()
    for i in range(5):
         circle(30*(i+1))
         up()
         goto(0,-30*(i+1))
         down()

     

    3.

    from turtle import*
    shape('turtle')

    color('orange')
    fillcolor('blue')
    begin_fill()
    while True:
          forward(200)
          left(200)
          if(abs(pos()))<1:
              break
    end_fill()
    done()

    4.

    shape('turtle')

    color('orange')
    fillcolor('blue')
    begin_fill()
    while True:
    forward(200)
    left(200)
    if(abs(pos()))<1:
    break
    end_fill()
    done()


    from turtle import*
    bgcolor('red')
    fillcolor('yellow')
    color('yellow')
    def wujiao(x,y):
    up()
    goto(x,y)
    down()
    wujiao(-300,230)
    begin_fill()
    for i in range(5):
    forward(100)
    right(144)
    end_fill()
    wujiao(-200,300)
    begin_fill()
    for i in range(5):
    forward(50)
    right(144)
    end_fill()
    wujiao(-150,250)
    begin_fill()
    for i in range(5):
    forward(50)
    right(144)
    end_fill()
    wujiao(-150,200)
    begin_fill()
    for i in range(5):
    forward(50)
    right(144)
    end_fill()
    wujiao(-200,150)
    begin_fill()
    for i in range(5):
    forward(50)
    right(144)
    end_fill()

  • 相关阅读:
    HDU-1272-小希的迷宫(并查集)
    HDU-1084-What Is Your Grade?
    一个好的函数(gcd)求最小公约数
    HDU-1228-A + B
    HDU-1029-Ignatius and the Princess IV
    自控力》读后感·一
    HDU-2058-The sum problem(数学题技巧型)
    HDU-1430-素数回文
    sftp
    802. 区间和
  • 原文地址:https://www.cnblogs.com/zheng01/p/7509238.html
Copyright © 2011-2022 走看看