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