Cole LaPlante Project 1
The purpose of this project was to create shapes with turtle in order to familiarize ourselves with python and the terminal interface. We became more familiar with parameters, functions, and more aspects of python through drawing simple shapes together. The goal eventually was to create complex images with few lines of code.
Task 1: shapeOne.py
I found the interior angle of a star online, which is 36 degrees, so I had to make the turtle go forward, then turn left(144) at each corner of the star and repeat it.
Task 2: shapeTwo.py
I found the interior angle of an octagon, which is 135 degrees, so I repeated the forward and left(45) commands eight times for each side of the octagon.
Task 3: shapes.py
I quickly realized that a star doesn't easily fit in an octagon. So, with trial and error, I was able to make the turtle draw the octagon so it appears that the star is close to perfectly centered. This is the code I used for shapeThree.
I used trial and error to find what positive x and what negative y value placed the octagon where it looked best.
Extension 1: extension1.py
I randomized the location of the shapeThree function so that it created a random array of 30 octagons with stars in the center.
I liked how the star looked in the octagon, so I tried to place them all over an area. I could have done more of them, but it took a decent amount of time for the turtle to draw just thirty of them.
this was the function I used to do that:
for i in range(30):
ranx = x + random.randint(-150,150)
rany = y + random.randint(-150,150)
What is a variable? A variable is a word or letter in a function that allows for code to be affected in different places at the same time.
What is a function and how are they useful? Functions are lines of code that are interpreted by python and carry out a specified action in an efficient way.
What is a parameter and how do they affect the generality of a function? Parameters are where values can be inputted into a function to make the function act in a specific way. For example, the parameters for the function to draw a block are the length and width.
How can you use functions to create complexity with less code? Functions can create complexity when you ask functions to carry out functions inside of functions, importing a function from another line of code.
Pick a wall drawing by Sol LeWitt that you think is interesting. Why? Do you think you could write code for it in python?
A brief description (1-3 sentences) of what you learned. Think about the answer to this question in terms of the stated purpose of the project. What are some specific things you had to learn or discover in order to complete the project?
A list of people you worked with, including TAs and professors. Include in that list anyone whose code you may have seen, such as those of friends who have taken the course in a previous semester.
A list of any resources that you used. This includes textbooks, lecture notes, python documentation, library documentation or forums. If you used a specific website, please link to it.
Put the label cs151s20project# on your wiki page.