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):

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

    # -*- coding: UTF-8 -*-# -*-
    import turtle
    from turtle import *
    
    
    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,100,100)
    turtle.hideturtle()
    
    turtle.up()
    mygoto(-280,100)
    turtle.down()
    
    turtle.begin_fill()
    for i in range(5):
            turtle.forward(80)
            turtle.right(144)
    turtle.end_fill()
    
    turtle.up()
    mygoto(-180,170)
    turtle.down()
    
    turtle.begin_fill()
    for i in range(5):
            turtle.forward(30)
            turtle.left(144)
    turtle.end_fill()
    
    turtle.up()
    mygoto(-140,120)
    turtle.down()
    
    turtle.begin_fill()
    for i in range(5):
            turtle.forward(30)
            turtle.left(144)
    turtle.end_fill()
    
    turtle.up()
    mygoto(-140,70)
    turtle.down()
    
    turtle.begin_fill()
    for i in range(5):
            turtle.forward(30)
            turtle.right(144)
    turtle.end_fill()
    
    turtle.up()
    mygoto(-180,20)
    turtle.down()
    
    turtle.begin_fill()
    for i in range(5):
            turtle.forward(30)
            turtle.left(144)
    turtle.end_fill()
    
    done()
    
    def draw_star(a):
        turtle.begin_fill()
        for i in range(5):
            turtle.forward(a)
            turtle.right(144)
        turtle.end_fill()

  • 相关阅读:
    Could not load file or assembly 'System.Core, Version=2.0.5.0
    r 数据分组处理
    r函数知识总结
    R-Sys.time计算程序运行时间
    R语言包_dplyr_1
    R语言系列:生成数据
    R语言-分组统计
    导数——平均变化率与瞬时变化率
    梯度下降法
    梯度
  • 原文地址:https://www.cnblogs.com/ashh/p/8573802.html
Copyright © 2011-2022 走看看