Embed Turtle Programs into our Class Blog

Due Mon, May 22, 2017 by midnight

Use the instructions below to submit a post with your Turtlehack embedded into it.

Sharing your work

Programmers often need or want to share their work with others. We’re going to do that by making a jekyll post with our code, a screenshot of our picture, and any thoughts or reflections we have on the experience.

First you need a header:

---
layout: post
author: tommytester
title: Tommy's Turtle Exercise
---

Then, go to your Trinket programs and follow the instructions here to get the embed code.

Then, paste the code into the text of your post. At this point your post will look something like this:

---
layout: post
author: tommytester
title: Tommy's Turtle Exercise
---

Here's the program I'm embedding:

    <iframe src="https://trinket.io/embed/python/c26c35e489" width="100%" height="356" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>

Static code blocks

If you want to display code that’s not interactive (to talk about something you did, for instance) , the cool grey boxes above come from telling Jekyll that we’re about to write code using backticks: `

```
# Look what I did here:
tess = turtle.Turtle()
tess.color("blue")
tess.pensize(3)
tess.forward(50)
tess.left(120)
tess.forward(50)
```

Here’s that code rendered by Jekyll:

# Look what I did here:
tess = turtle.Turtle()
tess.color("blue")
tess.pensize(3)
tess.forward(50)
tess.left(120)
tess.forward(50)

Images

Finally, if you need to embed an image, do it thusly:

![Turtle image](http://openbookproject.net/thinkcs/python/english3e/_images/tess03.png)

That code looks like this:

Turtle image

Thoughts about the exercise

When submitting exercises, it’s always awesomer to include reflections, roadblocks you ran into, or things you thought were cool. Always include links to example code if you use or are heavily influnced by someone else’s work. They don’t have to be long, but the best ones give me a sense of what you did and why. Here’s a post from last class that does a good job of this: Sarah’s post from Fall 2013

Going deeper

Think the above is easy? Try your hand at writing and calling functions. We’ll get to these later but an example from our very own Grant McLendon might help inspire you: Grant’s Turtle post form Fall 2013

Elliott Hauser is a PhD Student in information science at UNC Chapel Hill. He's hacking education as one of the cofounders of Trinket.io. Find Elliott Hauser on Twitter, Github, and on the web.