User:-Python turtle graphics-/hexagon hexagons: Difference between revisions
Luisa Moura (talk | contribs) (Created page with "thumbnail import turtle import random def hexagon(angle,size): angle=60 for i in range(6): turtle.forward(size) turtle.left(angle)...") |
Luisa Moura (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[File:Hexagon-hexagons.jpg | ==hexagon-hexagons== | ||
[[File:Hexagon-hexagons.jpg]] | |||
<source lang="python"> | |||
import turtle | import turtle | ||
Latest revision as of 08:05, 7 October 2013
hexagon-hexagons
<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(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()