generated from mwc/lab_names
Sorry for that, I guess I should have realized without new changes, committing wasn't really going to work. Anyway, the turtle by default points toward the right, so I used a side-length-then-turn-clockwise pattern to draw the triangle and rectangle. I did have to fix my rectangle though; I forgot the last turn at the end, so while the test worked well, the drawing looked like abstract art. I watched the turtle draw the shapes on my second run of the same incorrect code and noticed the direction changed which is how I knew what to fix. A function is like a variable in that variables store some value, while functions store instructions; in essence, they're both storage devices used to make code easier/more efficient to read, write, and understand. The small, easy problems are the basic under-defined functions that start off the whole problem-solving process. Taking these small pieces and making them into functions that do one specific job allow code to be tested easily as the larger problem is still being solved and make development of code smoother because fixing one problem (hopefully) doesn't break something else somewhere else in the program. An example that I've used with my students was designing a tic-tac-toe game using the turtle functions. Breaking the (simple but) larger problem into pieces might mean "can I just draw an x" so we wrote a function that just makes x's, then one that just made o's, then we used those functions inside of a function that asked the user for a position on the screen, along with another function that chose which symbol to draw depending on the turn counter, to make the game look as intended. |
||
---|---|---|
.commit_template | ||
.gitignore | ||
circle_area.py | ||
draw_with_shapes.py | ||
greetings.py | ||
pyproject.toml | ||
shapes.py | ||
test_shapes.py |