User:Lidia.Pereira/PNM/Turtle

From XPUB & Lens-Based wiki
< User:Lidia.Pereira‎ | PNM
Revision as of 08:17, 17 September 2013 by Lidia.Pereira (talk | contribs) (Created page with "First experiences with the turtle! (Thank you very much Tamas and Lucia for technical support) <syntaxhighlight lang="python"> import turtle import random def Poly(n,x): an...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

First experiences with the turtle! (Thank you very much Tamas and Lucia for technical support)

import turtle
import random

def Poly(n,x):
	angle = 360/n
	for i in range(n):
		turtle.forward(x)
		turtle.left(angle)

def loopieLoopie(p):
    for i in range(12):
            print Poly(9,p)
            turtle.left(30)

while(1):
    print loopieLoopie(random.randint(40,100)) 
    turtle.color(random.randint(0,1),random.randint(0,1),random.randint(0,1))


Networked2.png