zoukankan      html  css  js  c++  java
  • Python基础

    Pycharm开发环境设置与熟悉。

    练习基本输入输出:

    print('你好,{}.'.format(name))

    uprint(sys.argv)

    库的使用方法:

    import ...

    from ... import ...

    条件语句:

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

            break

    循环语句:

    for i in range(5):

    while True:

    函数定义:

    def mygoto(x,y):

    def drawjx(r):

    综合练习:画一面五星红旗,将代码与运行截图发布博客交作业。

    import sys
    import turtle
    from turtle import *
    
    sys.argv
    
    def draw_xing(n):
        turtle.begin_fill()
        for i in range(5):
            turtle.forward(n)
            turtle.right(144)
        turtle.end_fill()
    
    def mygoto(x,y):
        turtle.up()
        turtle.goto(x,y)
        turtle.down()
    
    turtle.bgcolor('red')
    turtle.color('yellow')
    turtle.fillcolor('yellow')
    turtle.setup(600,400,120,120)
    turtle.hideturtle()
    
    mygoto(-250,75)
    draw_xing(80)
    
    mygoto(-140,150)
    draw_xing(30)
    
    mygoto(-110,100)
    draw_xing(30)
    
    mygoto(-110,40)
    draw_xing(30)
    
    mygoto(-140,-10)
    draw_xing(30)
    
    turtle.done()
    

      

  • 相关阅读:
    linux进程管理类
    linux关机重启指令
    linux分区及磁盘挂载
    linux的运行级别
    property
    访问限制机制
    类的组合与封装
    继承与派生
    logging模块
    re模块
  • 原文地址:https://www.cnblogs.com/dengjinxiu/p/8584158.html
Copyright © 2011-2022 走看看