code.org > Artista

1

import turtle

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 1")
turtle.shape('turtle')
turtle.pensize(5)

turtle.penup()
turtle.setposition(-50, 50)
turtle.setheading(0)
turtle.pendown()

turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)

2

import turtle

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 2")
turtle.shape('turtle')
turtle.pensize(5)

turtle.penup()
turtle.setposition(-75, 0)
turtle.setheading(60)
turtle.pendown()

turtle.forward(150)
turtle.right(120)
turtle.forward(150)
turtle.right(60)
turtle.forward(150)
turtle.right(120)
turtle.forward(150)

3

import turtle

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 3")
turtle.shape('turtle')
turtle.pensize(5)

turtle.penup()
turtle.setposition(-50, 100)
turtle.setheading(0)
turtle.pendown()

turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)

4

import turtle

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 4")
turtle.shape('turtle')
turtle.pensize(5)

turtle.penup()
turtle.setposition(-50, 100)
turtle.setheading(0)
turtle.pendown()

for i in range(6):
    turtle.forward(100)
    turtle.right(60)

5

import turtle

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 5")
turtle.shape('turtle')
turtle.pensize(5)

for i in range(12):
    turtle.forward(100)
    turtle.right(30)
    turtle.forward(100)
    turtle.right(150)
    turtle.forward(100)
    turtle.right(30)
    turtle.forward(100)

6

import random
import turtle

def colore_casuale():
    red  =random.random()
    green=random.random()
    blue =random.random()
    turtle.pencolor(red, green, blue)

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 6")
turtle.shape('turtle')
turtle.pensize(5)

for i in range(12):
    colore_casuale()
    for j in range(2):
        turtle.forward(100)
        turtle.right(30)
        turtle.forward(100)
        turtle.right(150)
    turtle.right(30)

7

import random
import turtle

def colore_casuale():
    red  =random.random()
    green=random.random()
    blue =random.random()
    turtle.pencolor(red, green, blue)

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 7")
turtle.shape('turtle')
turtle.pensize(5)

for i in range(6):
    for j in range(6):
        colore_casuale()
        turtle.forward(100)
        turtle.right(60)
    turtle.right(60)

8

import random
import turtle

def colore_casuale():
    red  =random.random()
    green=random.random()
    blue =random.random()
    turtle.pencolor(red, green, blue)

def fiore():
    for i in range(6):
        colore_casuale()
        for j in range(8):
            turtle.forward(25)
            turtle.right(30)
        turtle.right(60)

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 8")
turtle.shape('turtle')
turtle.pensize(5)

turtle.penup()
turtle.setposition(-150, 200)
turtle.pendown()

for i in range(3):
    turtle.setheading(-30)
    fiore()
    turtle.penup()
    turtle.setposition(turtle.xcor() + 120, 
                       turtle.ycor() - 120)
    turtle.pendown()

9

import random
import turtle

def colore_casuale():
    red  =random.random()
    green=random.random()
    blue =random.random()
    turtle.pencolor(red, green, blue)

def figura():
    for i in range(6):
        turtle.forward(30)
        turtle.right(60)

WIDTH =500
HEIGHT=500

turtle.setup(WIDTH, HEIGHT)
turtle.title("Artista 9")
turtle.shape('turtle')
turtle.pensize(2)
turtle.penup()
turtle.setposition(-160, -120)

for i in range(6):
    for j in range(2):
        colore_casuale()
        for k in range(4):
            turtle.pendown()
            figura()
            turtle.penup()
            turtle.forward(90)            
        turtle.backward(30)
        turtle.right(60)
        turtle.forward(30)
        turtle.right(120)
    turtle.backward(30)
    turtle.left(60)
    turtle.forward(60)
    turtle.right(60)

Lascia un commento