Skip to content

Instantly share code, notes, and snippets.

@shiumachi
Created November 29, 2018 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiumachi/e26e40690c543cd85b70e760389213ee to your computer and use it in GitHub Desktop.
Save shiumachi/e26e40690c543cd85b70e760389213ee to your computer and use it in GitHub Desktop.
def print_arr_right_aligned(arr):
""" input: string array ['a', 'ab', 'abc']
output: None. print with right aligned.
a:
ab:
abc:
"""
len_a = max(map(lambda x: len(x), arr))
for i in arr:
print("{0:>{1}}: ".format(i, len_a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment