5 Replies - 578 Views - Last Post: 11 September 2012 - 03:22 PM Rate Topic: -----

#1 bigshow3010  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-September 12

Please help me with Python (cTurtle)

Posted 11 September 2012 - 10:49 AM

I have a problem about using cTurtle to draw this pictures (using Python 3.2) Can someone have me with this.
Posted Image

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: Please help me with Python (cTurtle)

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8958
  • View blog
  • Posts: 33,585
  • Joined: 12-June 08

Re: Please help me with Python (cTurtle)

Posted 11 September 2012 - 10:54 AM

Help you.. how? Where's your code attempting this?
Was This Post Helpful? 1
  • +
  • -

#3 bigshow3010  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-September 12

Re: Please help me with Python (cTurtle)

Posted 11 September 2012 - 02:12 PM

import cTurtle
otis = cTurtle.Turtle()

for i in range (4):
    otis.forward(40)
    otis.left(90)


MOD EDIT: Added code tags. When posting code...USE CODE TAGS!!!

ESPECIALLY in Python, where indentation is of paramount importance!

:code:

This post has been edited by JackOfAllTrades: 11 September 2012 - 02:21 PM

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8958
  • View blog
  • Posts: 33,585
  • Joined: 12-June 08

Re: Please help me with Python (cTurtle)

Posted 11 September 2012 - 02:34 PM

Okay.. so say your chunk of code outloud and see if it makes sense..

Quote

for variable i to 4 - aka repeat this five times..

move forward 40
turn left 90

repeat.


Does that make sense to you?
Was This Post Helpful? 0
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,437
  • Joined: 23-August 08

Re: Please help me with Python (cTurtle)

Posted 11 September 2012 - 03:06 PM

What might be really helpful here would be to draw this pattern on graph paper.
Was This Post Helpful? 0
  • +
  • -

#6 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: Please help me with Python (cTurtle)

Posted 11 September 2012 - 03:22 PM

The code you've provided should nicely draw a square. I too am worried you might not understand this code though, could you give us a plain english explanation as to what's going on in your code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1