Print list items in a rectangular frame
You can let .format() do most of the work for you:

def print_in_a_frame(*words):
    size = max(len(word) for word in words)
    print('*' * (size + 4))
    for word in words:
        print('* {:&lt;{}} *'.format(word, size))
    print('*' * (size + 4))

&gt;&gt;&gt; print_in_a_frame("Hello", "World", "in", "a", "frame")
*********
* Hello *
* World *
* in    *
* a     *
* frame *
*********


Most of the magic happens in this line:

print('* {:&lt;{}} *'.format(word, size))


It may be easier to understand what's going on if we rewrite it as:

print('* {a:&lt;{b}} *'.format(a=word, b=size))


This tells format to print the keyword argument a, left-aligned, on a field of total width the keyword argument b.  Note that if b was fixed, say to 10, you would write that as:

print('* {a:&lt;10}} *'.format(a=word))


or:

print('* {:&lt;10}} *'.format(word))