zoukankan      html  css  js  c++  java
  • python第二节课

    import turtle
    turtle.shape('turtle')
    turtle.speed(5)
    turtle.color('green')
    var=1
    while var == 1:
          for i in range(5):
              turtle.forward(200)
              turtle.right(144)
       
    

    无限循环的五角星

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

     用循环画同心圆

    import turtle
    turtle.shape('turtle')
    turtle.speed(5)
    turtle.color('yellow')
    turtle.bgcolor('red')
    turtle.fillcolor('yellow')
    
    def my_goto(x,y):
        turtle.up()
        turtle.goto(x,y)
        turtle.down()
    
    def my_star5(r):
        turtle.begin_fill()
        for i in range(5):
            turtle.forward(r)
            turtle.right(144)
            turtle.end_fill()
    
    my_goto(-250,100)
    my_star5(100)
    
    my_goto(-150,75)
    my_star5(50)
    
    my_goto(-100,50)
    my_star5(50)
    
    my_goto(-50,25)
    my_star5(50)
    
    my_goto(-0,0)
    my_star5(50)
    

    用函数画了五个五角星

    import turtle
    
    def draw_diamond(brad):
        brad.forward(100)
        brad.right(45)
        brad.forward(100)
        brad.right(135)
    
    def draw_art():
        window=turtle.Screen()
        window.bgcolor("pink")
    
        brad=turtle.Turtle()
        brad.shape('turtle')
        brad.color('yellow')
        brad.speed(100)
    
        for i in range(1,37):
            draw_diamond(brad)
            draw_diamond(brad)
            brad.left(10)
    
    draw_art()
    

    画一朵花

    r = input("请输入学号:")
    print("学年:",r[:4])
    print(r[4:6],":代表网络工程")
    print("学号:",r[10:12])
    

    输入学号识别年级专业序号

    r = input("请输入数字:")
    print('星期',r)
    

     星期几

  • 相关阅读:
    linux下载和解压命令
    检测是否存在post类型的注入
    snort的学习
    解决ERROR: D:Snortetcsnort.conf(511) Unknown preprocessor: "sip". Fatal Error, Quitting..
    代理服务器
    Settimer及回调函数的用法
    vm安装ubantu的详细过程(转载)
    linux 常用指令汇总
    linux 用户及文件权限管理
    linux 基础知识
  • 原文地址:https://www.cnblogs.com/money1995/p/7513470.html
Copyright © 2011-2022 走看看