# reorder.py # Walker M. White (wmw2) # September 2, 2015 """Functions for reordering a string (complete)""" def last_name_first(s): """Returns: copy of s but in the form , Parameter s: a name Precondition: s is a string with one or more blanks between the two names""" first = first_name(s) last = last_name(s) return last+', '+first def first_name(s): """Returns: First name in s Parameter s: a name Precondition: s is a string with one or more blanks between the two names""" end_first = s.find(' ') return s[:end_first] def last_name(s): """Return: Last name in s Parameter s: a name Precondition: s is a string with one or more blanks between the two names""" start = s.rfind(' ') return s[start+1:]