User:Luisa Moura/prototyping/python/turtle

From XPUB & Lens-Based wiki
< User:Luisa Moura‎ | prototyping/python
Revision as of 15:17, 9 April 2014 by Luisa Moura (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Flower hexagon.jpg

<source lang="python">

import turtle

import random

def hexagon(angle,size):

angle=60

for i in range(6):

turtle.forward(size)

turtle.left(angle)

def drawing(size):

for i in range(18):

print hexagon(60,size)

turtle.left(20)

while(1):

print drawing(random.randint(40,100))

turtle.color(random.randint(0,1),random.randint(0,1),random.randint(0,1))

turtle.width(random.randint(1,2))

turtle.exitonclick()