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):
综合练习:画一面五星红旗,将代码与运行截图发布博客交作业。
import sys
import turtle
print('你好')
turtle.setup(1500,800,0,0)
turtle.bgcolor('red')
turtle.color('yellow')
turtle.pensize(5)
def mygoto(x,y):
turtle.up();
turtle.goto(x,y);
turtle.down();
def drawfive(z):
turtle.begin_fill();
for i in range(5):
turtle.forward(z)
turtle.right(144)
turtle.end_fill();
mygoto(-600,175)
drawfive(200)
mygoto(-350,75)
drawfive(50)
mygoto(-300,175)
drawfive(50)
mygoto(-350,250)
drawfive(50)
mygoto(-450,300)
drawfive(50)
turtle.done()