Skip to content

Instantly share code, notes, and snippets.

@nathan-cruz77
Created August 11, 2018 03:17
Show Gist options
  • Save nathan-cruz77/9824ed30376fa020b2460032426531ca to your computer and use it in GitHub Desktop.
Save nathan-cruz77/9824ed30376fa020b2460032426531ca to your computer and use it in GitHub Desktop.
# Return stirng representation of given array of building sizes (with overall height of 9)
#
# Sample usage:
#
# >>> print(buildings('252'))
#
#
#
#
# #
# #
# #
# ###
# ###
#
def buildings(ints):
heights = [int(i) for i in ints]
s = ''
for a in zip(*[('#' * int(i)).rjust(9) for i in heights]):
for i in a:
s += i
s += '\n'
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment