zoukankan      html  css  js  c++  java
  • 9.12

    注意标准库的两种导入与使用方式,建议大家采用<库名>.<函数名>的方式。

    对前面的代码进行优化,用for,while,if,def实现:

    画五角星

    import turtle
    turtle.color('yellow','yellow')
    turtle.begin_fill()
    for i in range(5):
    turtle.forward(200)
    turtle.right(144)
    turtle.end_fill()

    画同心圆

    import turtle
    for i in range(5):
    turtle.up()
    turtle.goto(0,-20*(i+1))
    turtle.down()
    turtle.circle(20*(i+1))

    画太阳花

    import turtle
    turtle.color('red','blue')
    turtle.begin_fill()
    while True:
    turtle.forward(200)
    turtle.left(165)
    if(abs(turtle.pos()))<1:
    break
    turtle.end_fill()

    画五个角星

    import turtle
    turtle.color('yellow','yellow')
    turtle.bgcolor('red')
    def lmhgoto(x,y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()
    lmhgoto(-250,100)
    turtle.begin_fill()
    for i in range(5):
    turtle.forward(125)
    turtle.right(144)
    turtle.end_fill()
    lmhgoto(-90,120)
    turtle.begin_fill()
    for i in range(5):
    turtle.forward(30)
    turtle.left(144)
    turtle.end_fill()
    lmhgoto(-120,165)
    turtle.begin_fill()
    for i in range(5):
    turtle.forward(30)
    turtle.left(144)
    turtle.end_fill()
    lmhgoto(-95,65)
    turtle.begin_fill()
    for i in range(5):
    turtle.forward(30)
    turtle.right(144)
    turtle.end_fill()
    lmhgoto(-120,10)
    turtle.begin_fill()
    for i in range(5):
    turtle.forward(30)
    turtle.left(144)
    turtle.end_fill()

  • 相关阅读:
    vue-router过渡动画
    vue-router重定向
    vue-router url传值
    vue-router多个组件模板放入同一个页面中
    vue-router参数
    vue-router子路由
    vue-router入门
    easyui中parser的简单用法
    webpost中常用的ContentType
    ASP.NET MVC 表单提交多层子级实体集合数据到控制器中
  • 原文地址:https://www.cnblogs.com/liminghui3/p/7509609.html
Copyright © 2011-2022 走看看