python 考试大题预测

2022/7/1 1:19:27

本文主要是介绍python 考试大题预测,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

#第一关绘制等边三角形
#********* Begin *********#
import turtle as tl

tl.pencolor('red')
tl.pendown()
tl.left(60)
tl.forward(200)
tl.right(120)
tl.forward(200)
tl.right(120)
tl.forward(200)
#********* End *********#
#保存屏幕图片
ts = tl.getscreen()
ts.getcanvas().postscript(file="Python/src1/py1-1/yourimg/sj.ps")
#第二关绘制两个叠加的等边三角形
#********* Begin *********#
import turtle as tl


tl.pencolor('red')
tl.pendown()
tl.left(60)
tl.forward(200)
tl.right(120)
tl.forward(200)
tl.right(120)
tl.forward(200)

tl.begin_fill()
tl.right(60)

tl.right(120)
tl.pencolor('blue')
tl.fillcolor('yellow')
tl.penup()
tl.forward(100)
tl.pendown()
tl.left(60)
tl.forward(100)
tl.left(120)
tl.forward(100)
tl.left(120)
tl.forward(100)
tl.end_fill()
tl.end_fill()
#********* End *********#
#保存屏幕图片
ts = tl.getscreen()
ts.getcanvas().postscript(file="Python/src1/py1-2/yourimg/sj.ps")

#第三关 绘制三个叠加的等边三角形
#********* Begin *********#
import turtle as tl

tl.pencolor('red')
tl.pendown()
tl.left(60)
tl.forward(200)
tl.right(120)
tl.forward(200)
tl.right(120)
tl.forward(200)

tl.begin_fill()
tl.right(60)

tl.right(120)
tl.pencolor('blue')
tl.fillcolor('yellow')
tl.penup()
tl.forward(100)
tl.pendown()
tl.left(60)
tl.forward(100)
tl.left(120)
tl.forward(100)
tl.left(120)
tl.forward(100)
tl.end_fill()

tl.left(120)
tl.forward(50)
tl.left(60)
tl.begin_fill()
tl.pencolor('red')
tl.fillcolor('white')
tl.forward(50)
tl.left(120)
tl.forward(50)
tl.left(120)
tl.forward(50)
tl.end_fill()
#********* End *********#
#保存屏幕图片
ts = tl.getscreen()
ts.getcanvas().postscript(file="Python/src1/py1-3/yourimg/sj.ps")



这篇关于python 考试大题预测的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程