Payal's Turtle-Function Exercise

by Payal Patel

27 Jan 2016

Original Turtle Program:

Modified Turtle Program with Functions:

Reflection: Recreating this turtle program to include functions showed me how much time (and space) can be saved by using functions. My initial turtle program repeated several lines of code just to get the same design in different spots, but once I created a function I was able to create the same design with one line of code. I didn’t think it was too hard to take the code I already had and create functions from it, however, I did have a hard time thinking of a function using return. I think this is because I was initially thinking of how I could add some sort of calculation into my turtle program, but once I realized that I could return a string I decided to create a signature function that a user could call once they have finished their work. They would then be given a congratulations message.

Payal is a junior at UNC-Chapel Hill majoring in Information Science. Find Payal Patel on Twitter, Github, and on the web.