Wondering about learning Python

Duncan Booth me at privacy.net
Thu Jul 22 13:50:10 CEST 2004


Chris <nospam@[127.0.0.1]> wrote in news:bKe5VVARw5$AFwRs@[127.0.0.1]:

> Anyway, I wonder if anyone would be so kind as to convert it to Python.
> 
> I'm wondering about learning Python - just for fun - and it would be 
> interesting to see how easy it is in comparison with qbasic.

Python version (put it in a file 'spiral.py' then just run it):

from turtle import *

def spiral():
    reset()
    degrees()
    tracer(0)
    for i in range(40000):
            t = i/100.
            x = .5 * t * cos(t)
            y = .5 * t * sin(t)
            goto(x, y)

if __name__=='__main__':
    spiral()
    # The code below lets the screen update and then waits until you
    # close the window.
    import turtle
    turtle._root.mainloop()



More information about the Python-list mailing list