Advertisement
Peaser

frame and fortune

Jul 16th, 2015
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. def frame_and_fortune(string):
  2.     retval = ""
  3.     data = string.split()
  4.     tempdat = sorted(data, key=len, reverse=1)
  5.     mval = len(tempdat[0])
  6.     intemp = mval + 4
  7.     retval += "*" * intemp
  8.     retval += "\n"
  9.     for word in data:
  10.         retval += "* {0}{1} *\n".format(word, " "*(mval - len(word)))
  11.     retval += "*" * intemp
  12.     return retval
  13.  
  14. print frame_and_fortune("This is a test look at how testy i am")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement