《Think Python》笔记1
程序员文章站
2022-04-25 20:26:35
...
《Think Python : How to think like a computer scientist》是一本很不错的入门书。它的例子也很好玩。作者写的TurtleWorld很有意思。分享一下。
from swampy.TurtleWorld import *
def square(t,length):
for i in range(4):
fd(t,length)
lt(t)
world = TurtleWorld()
bob = Turtle()
for i in range(10,200,10):
square(bob,i)
wait_for_user()
fd():前进
lt():左转
转载于:https://my.oschina.net/u/923087/blog/279336