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
———————————–

 

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.