# name.py # Walker M. White (wmw2) # August 31, 2012 """Module with a single, non-working function. The function in this module has a bug (in the sense that it does not satisfy its specification). This allows us to show off debugging.""" def last_name_first(n): """Returns: copy of n but in the form 'last-name, first-name' Precondition: n is in the form 'first-name last-name' with one or more blanks between the two names no spaces in or """ first = first_name(n) last = last_name(n) return last+', '+first def first_name(n): """Returns: first name from n Precondition: n is in the form 'first-name last-name' with one or more blanks between the two names no spaces in or """ end = n.find(' ') return n[:end] def last_name(n): """Returns: last name from n Precondition: n is in the form 'first-name last-name' with one or more blanks between the two names no spaces in or """ end = n.find(' ') result = n[end+1:] return result.strip()