Less is More…
While looking over my code, I remembered a quote from my teaching days that is quite applicable to coding:
“If you have to repeat yourself more than 3 times, you’re not doing something right.”
Reviewing my first attempt, I repeated myself multiple times, and I knew it could be simpler. We have already discussed loops, and that would make my code more efficient and compact. With some additional work, I was able to get it down to 42 lines of code, 63% less!