[Week 7] Mid-sem break
This week I learnt to hate triangles. The exercises focused on refraction and refactoring. While some was a cruise to get through, other parts made me question what I needed to do to return the correct result.
My notes on new/unfamiliar content:
These are some of the things I saw while completing the exercises or while doing some research that I found new:
Week 5 exercises:
Ex1 — triangles, triangles and more triangles:
The first component was straight forward, using basic math principles to calculate values of a triangle. For the aspect I did overthink it a little, but luckily saw a conversation of slack about what the function should output and was able to easily implement this.
The next parts focus on making and using a dictionary to store and present data about the triangle, both in writing and diagrammatically. One thing to notes is to use {} to return dictionaries!
Ex2 — bringing out my inner Italian:
If it wasn’t for the sample/example code in this exercise I probably would have found it quite difficult. Luckily it had this so you could read, research and understand the sample then apply a similar approach to a different problem.
I did get stuck on why my sqaure_koch wasn’t working for quite some time and kept changing different aspects to try get it to pass, but it turned out I forgot to maintain the trace (shout out to Ben for noticing!). But hey after working on it for so long I was told I had “some pretty neat optimisation” so that my achievement of the week.
docsting test or patience test?:
Here is an example of a piece of code that does pass the test:
Note:
“““_””” directly after calling function
Begins with a capital
Ends with a ‘.’
First word should be in imperative mood
no trailing white space
For multi line —
Quotes on a separate line
First line ends with a ‘.’
1 blank line between summary and description line