User:-Python turtle graphics-/flower hexagon: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "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(...")
 
No edit summary
Line 1: Line 1:
[[File:Hexagon-hexagons.jpg|thumbnail]]
import turtle
import turtle



Revision as of 07:52, 7 October 2013

Hexagon-hexagons.jpg

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(6):

print hexagon(60,size)

turtle.left(60)


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(0,3))


turtle.exitonclick()