Think Like a Programmer (Python)

think_like_a_programmer

I am currently working (reading) through the excellent “Think Like a Programmer” (V. Anton Spraul) from No Starch Press. The book is written with C++ in mind, but I will instead be trying to solve the puzzles using Python. The book contains C++ solutions, but I want to a) figure out the solution in Python and b) figure it out before reading the C++ solution.

I will not be posting a new blog post each time I solve something, instead I will update this one. I also will only be posting the puzzle titles, not the puzzle information; if you want the puzzle information then please pick up the book.


Chapter Two: Half a Square

i = 4
while (i >=0):
string = ‘#’
print_me = (string*(int(i/len(string))+1))
print(print_me)
i=i-1
———————————–