Code:
CP11 – Rahimi – Snowmen Code.py
Result:
Reflection:
This project was to present how well we understood loops and how we were able to use them to simplify our code. Before starting, I had to imagine a picture that would use a lot of repetition and would allow me to use ‘for’ loops, ‘while’ loops, and counters. I decided to make snowmen because it uses a lot of repetition of shapes. The problem I faced when creating this code was that I didn’t fully understand the loops, so I wasn’t able to optimize my use of them. When I finished, I had only one loop and I didn’t know where else to fit the missing loops. It wasn’t until I presented my problem to my teacher, that I learned I had written sequences that weren’t necessary. The purpose of the loop is to avoid writing out the code for a shape every time it is used, but that was exactly what I did. I refined my code by making a definition of each shape and learning how to use the loops to make them repeat in different parts of the picture. I had a lot of thought go into my snowflakes and arms because the use of angles in Python is very different. After a bunch of trials and errors, I learned how to reset the angle for the shape in order to create the arms and snowflakes that I wanted. In the end, developing the design for each shape was a very interesting process that taught me a lot about drawing using Python, especially when using loops or angles.