【发布时间】:2017-02-10 00:17:31
【问题描述】:
只是回顾我即将到来的期中考试。我们得到了过去的中期问题,但没有解决方案。我正在尽我所能掌握知识。
对于这个问题,它要求定义一个名为 equalSigns 的函数,将值 t 和长度传递给它。所以,我只需要在海龟图形中制作我的程序,创建两条平行线,我想很简单。这是我编写的代码,只是为了正确输出 x 长度的等号。 (那我当然会把它转换成一个函数)我的问题,有没有更好的方法来创建它?
import turtle
t=turtle.Turtle()
s=turtle.Screen()
t.forward(200)
t.penup()
t.home()
t.right(90)
t.forward(50)
t.pendown()
t.left(90)
t.forward(200)
'''i suppose i dont have to go home and then down.
instead just continue and go down and forward left.
but either way, is this the best approach to take?
'''
【问题讨论】: