4 ms·
https://docs.python.org/3/library/turtle.html https://docs.python.org/3/library/turtle.html $ python from turtle import * color('red', 'yellow')
by harry8 6y ago
https://docs.python.org/3/library/turtle.html https://docs.python.org/3/library/turtle.html
$ python
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()
In case, like me for years, you didn't know it was there...
- pgtan 6y agothis is a brilliant example how awful ugly python with its loops is (also compared to logo)
- bitwize 6y agoI used Python's turtle module to show my nephew the basics of programming. I even got to show him what "refactoring" was, by having the turtle draw a part of the picture and then abstracting that into a function that got called when drawing the whole picture.
- zozbot234 6y agoThis is not really LOGO though, it's just turtle graphics which is discussed in the paper as merely one possible "microworld" for programming. LOGO itself makes a lot more sense than Python as an introduction to computer programming. (It has some real misfeatures, but the paper discusses at least one of them at length - namely dynamic scope, which basically endows each program binding with its own independent "stack", instead of featuring a single stack of activation records as in most programming languages - and concludes that it may make the language somewhat friendlier to newcomers.)