作业一: 安装完成Pycharm,然后打开Pycharm进入开发环境。创建Python File文件,然后输入print(“hello,world”),然后单击运行。 作业二: #绘制奥运五环 import turtle turtle.width(5) turtle.color(“blue”) turtle.circle(50) turtle.penup() turtle.goto(110,0) turtle.pendown() turtle.color(“black”) turtle.circle(50) turtle.penup() turtle.goto(220,0) turtle.pendown() turtle.color(“red”) turtle.circle(50) turtle.penup() turtle.goto(55,-50) turtle.pendown() turtle.color(“yellow”) turtle.circle(50) turtle.penup() turtle.goto(165,-50) turtle.pendown() turtle.color(“green”) turtle.circle(50) turtle.done() 运行结果如图: 作业三: 方法一:import turtle turtle.width(2) turtle.color(“red”) turtle.goto(50, 0) turtle.goto(50, 50) turtle.goto(0, 50) turtle.goto(0, 0)
turtle.penup() turtle.goto(60, 0) turtle.pendown() turtle.goto(110, 0) turtle.goto(110, 50) turtle.goto(60, 50) turtle.goto(60, 0)
turtle.penup() turtle.goto(0, -10) turtle.pendown() turtle.goto(50, -10) turtle.goto(50, -60) turtle.goto(0, -60) turtle.goto(0, -10)
turtle.penup() turtle.goto(60, -10) turtle.pendown() turtle.goto(110, -10) turtle.goto(110, -60) turtle.goto(60, -60) turtle.goto(60, -10) turtle.done() 运行如图: 方法二: import turtle turtle.width(1) turtle.color(“blue”) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.penup() turtle.goto(110, 0) turtle.pendown()
turtle.left(90) turtle.color(“red”) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.left(90) turtle.forward(100) turtle.penup() turtle.goto(0, -10) turtle.pendown()
turtle.left(90) turtle.color(“green”) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.penup() turtle.goto(110, -10) turtle.pendown()
turtle.right(90) turtle.color(“yellow”) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.penup() turtle.goto(110, -10) turtle.pendown() turtle.done() 结果如图:
|