Jump to content

Dabbling in Python with Turtle


Dan13

Recommended Posts

I started Stef's KillerPython as a programming refresher and to clarify some things in Python.  I like this tool Turtle that he chose to explain things.  It's less complicated than other tutorials I've seen trying to use TKinter or even worse PyGame.  

In the attached code, I have functions for drawing a square or triangle making use of For Loops and If Then statements.  The first argument controls the size of the shapes.  I wanted a way to accept a second argument telling the Turtle to draw the shape to the left or the right, but I seemed to be getting into a weird situation trying to get Words or Strings accepted as arguments.  

I defined right = 1 and left = 2 so they sort of behaved like integers in my IF statement.  

Anyway, so far I'm enjoying the approach to KillerPython.  As I said in a post on YouTube, I've had some coding classes that leaned heavily on Power Point and were so awfully boring lol.  This is much better feeling more casual and interactive.  

 

 

 

 

Testing.py

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...