Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exercise-3.5.py #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 16 additions & 37 deletions chapter-3/exercise-3.5.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,34 @@

Created by Terry Bates on 2012-07-15.
Copyright (c) 2012 http://the-awesome-python-blog.posterous.com.
All rights reserved."""


def print_twice(my_string):
print my_string
print my_string


def do_twice(f):
f()
f()
All rights reserved.

Cut down on some lines
Ciprian Saramet on 2019-11-22

"""
def do_four(f):
do_twice(f)
do_twice(f)

def do_twice(f):
f()
f()

def print_beam():
print '+ - - - -',

print('+ - - - -', end="")

def print_post():
print'| ',
def print_pillar():
print('| | |', end="\n")


def print_beams():
def tier():
do_twice(print_beam)
print '+'


def print_posts():
do_twice(print_post)
print '|'


def print_row():
print_beams()
do_four(print_posts)


def print_grid():
do_twice(print_row)

print('+')
do_four(print_pillar)

def main():
print_grid()
print_beams()


do_twice(tier)
do_twice(print_beam)
print('+')
if __name__ == '__main__':
main()