miércoles, 18 de octubre de 2017

Figuras con for

cuadrado

import turtle

turtle.speed(1)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.exitonclick()

cuadrado con for

import turtle

turtle.speed(100)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
a=0
for x in range (40):
    turtle.forward(100)
    turtle.right(90)

    for i in range(1):
        turtle.forward(100)
        turtle.right(80)


turtle.exitonclick()

triangulo con for

import turtle

turtle.speed(100)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
a=0
for x in range (40):
    turtle.forward(100)
    turtle.left(120)

    #for i in range(10):
    #   turtle.forward(130)
     #   turtle.right(110)


turtle.exitonclick()

Rombo con for
import turtle

turtle.speed(1)
fonde = turtle.Screen()
fonde.bgcolor("yellow")
a=0for x in range (3):
    turtle.forward(100)
    turtle.left(120)

turtle.home()

for x in range (3):
    turtle.forward(100)
    turtle.right(120)



turtle.exitonc

No hay comentarios:

Publicar un comentario