DISCLAIMER: This code is not to be copied from! If you simply copy, you will never learn. You will not have access to this in the exam. If that is not enough to discourage you from copying, know that if you submit a solution too similar to this, and someone else does as well, you run the risk of getting caught and both of you will get a 0. This has happened to some members of my class (in first year 2018/19).
The reason I made this public is so that I should be available as an aid and a reference to help guide other students while doing the homeworks. When using this code, it is important that you analyse how and why the code works as it does, and you don't just take the code for granted.
Note, it is not always the case that my way is the best way. I consider myself somewhat a perfectionist, so you may find that much of the time my code is overly complicated, and does for more than is required, especially in the earlier homework assignments. So don't freak out if in some cases you see that I use way too many lines of code to achieve a relatively simple task.
Having said that, this is not usually the case, and I like to think that it can serve as a pretty helpful guide to those in need of one. So I hope that if this finds it's way to your hands, you find this helpful and learn a lot from this.