# string_puzzle_soln.py
# Lillian Lee (LJL2) and Steve Marschner (SRM2)
# Jan 30, 2014

"""Demonstrate putting a sequence of commands into a python file.
   This version is the starting point for altering in class.

   Given: variable data contains a string with at least two ','s.
   Goal: give an expression for the part of the string after the 2nd ','.  

    """

# let's use the example from lecture
data="LL, '14,  1-800-OPYTHON, 1-555-TYPHOON"

# (1) Store in variable j the index of the first ',' in data.
j = data.index(',')

# (2) Store in variable tail the part of data starting after j
tail = data[j+1:]

# (3) print the part of tail starting after ','
print 'result string is "' + tail[tail.index(',')+1:] +'"'

# here's a version as a one-liner
#  data[data.index(',')+1:][data[data.index(',')+1:].index(',')+1:]