0

So I am learning python and after each page the website asks me to practice. They use turtles as an example if things work since it's easy to spot. Now, I don't have any idea at all how to do this one. I am supposed to draw this: http://puu.sh/8f0fA.jpg

This is the code I got so far (I do know it isn't the way to do it but it is at least a foundation to start off with)

import turtle

def pattern(turtle, sideLenght):
    for i in range(6):
        turtle.up()
        turtle.goto(turtle.pos() + (+10,+10))
        turtle.left(90)
        turtle.forward(sideLenght)
        turtle.down()
        for i in range(4):
            turtle.forward(sideLenght)
            turtle.left(90)


wn = turtle.Screen()
wn.bgcolor("lightgreen")

alex = turtle.Turtle()
alex.color("pink")
alex.pensize(4)
alex.speed(1)

pattern(alex,200)
wn.exitonclick()
Czarek
  • 597
  • 1
  • 10
  • 20
  • 1
    That pattern is made up of 5 squares, each of which has a cross starting from the centre of each side. I would write a function to draw one such shape, then once that was working build on it to produce the extra four with an offset of `90 / 5 == 18` degrees. – jonrsharpe Apr 19 '14 at 18:06
  • @jonrsharpe I am not sure if I did it right, but this is what I did and it worked. Thanks for the help :) http://pastebin.com/v7ptYjNS – Czarek Apr 20 '14 at 05:33
  • related: [ASCII art in Python](http://stackoverflow.com/a/13103231/4279) – jfs Oct 18 '15 at 13:32

0 Answers0