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 -*- from turtle import * def mygoto(x,y): up() goto(x,y) down() def drawStar(r): begin_fill() for i in range(5): forward(r) right(144) end_fill() setup(800,600) bgcolor('red') color('yellow') fillcolor('yellow') mygoto(-335,125) drawStar(100) mygoto(-240,200) drawStar(50) mygoto(-180,140) drawStar(50) mygoto(-180,75) drawStar(50) mygoto(-240,30) drawStar(50) done()
截图: