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

posted on 2018-03-15 15:19  189黄思慧  阅读(118)  评论(0编辑  收藏  举报