I am writing a program that is supposed to print a word in a box made of stars like this:
************
* *
* danielle *
* *
************
However, I am getting the following output:
************
*
None *
* danielle *
*
None *
************
I know I keep getting an output of "None" because I can't print a string and a function output on the same line. How could I do this?
My code is as follows:
def star_str(length):
stars = '*'*length
print stars
def spaces_str(length):
spaces = " "*length
print spaces
def frame_word(input_word):
length = len(input_word)
top_bottom_stars = length + 4
spaces_middle = length + 2
star_str(top_bottom_stars)
print '*', spaces_str(spaces_middle), '*'
print '*', input_word, '*'
print '*', spaces_str(spaces_middle), '*'
star_str(top_bottom_stars)
print "Please enter a word:",
input_word = raw_input()
frame_word(input_word)