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 turtle turtle.setup(600,400) turtle.color("yellow") turtle.bgcolor("red") turtle.fillcolor("yellow") def mygoto(x,y): turtle.up() turtle.goto(x,y) turtle.down() def drawsatr(r): turtle.begin_fill() for i in range(5): turtle.forward(r) turtle.right(144) turtle.end_fill() mygoto(-250,75) drawsatr(90) mygoto(-110,150) drawsatr(40) mygoto(-70,100) drawsatr(40) mygoto(-70,50) drawsatr(40) mygoto(-110,0) drawsatr(40) turtle.hideturtle() turtle.done()
运行结果截图: