Note : My solutions are independent of the solutions provided by the author. Just an info.
I tried to be a bit flexible with the solution by adding arguments, which allows variations in the number of columns and spacing between “+” and “-”.
Difficulty: I tried to replicate the exact grid but the spacing was quite confusing for me. If you have an idea, do reference your solution. Thanks.
I was itching to use Python’s syntax for iterations since I do have a programming background knowledge, but I decided to stick with the timeline of the book. But once you complete the recursion & iteration chapter, I would recommend you redo this exercise by using your newly gained knowledge. Additionally, it would simply be another way to confirm your understanding on iterations.
The concept of passing a function as an argument
If you have any questions regarding the thought process, do not hesitate to ask. See you in the next chapter!
Other related articles
- Beginner Automating with Python | Converting MYSQL database tables into single CSV files
- Python Learning: Automate Boring Stuff with Python | Chapter 12: Spreadsheet to Text Files