2 3 Consider a list of values xs Find and return the value
Solution
def get( xs, index, response=None):
    if( index >= len(xs) or index < 0):
        return response;
    return xs[index];
print get( [\'a\',\'b\',\'c\'], 0 );
 print get( [\'a\',\'b\',\'c\'], 3 );
 print get( [\'a\',\'b\',\'c\'], 4, \"oops\" );
def classify( input_string ):
    input_string= input_string.split(\" \");
    numbers= [];
    words = [];
    for x in input_string:
        try:
            x = int(x);
            numbers.append(x);
        except:
               if x <> \'\':
                words.append(x);
    return [ numbers, words ];
def shelve( inventory, product_list ):
    for p in product_list:
        try:
            inventory[ p[0] ] = inventory[ p[0] ] + p[1];
        except:
            inventory[ p[0] ] = p[1];
        if inventory[ p[0] ] < 0:
            raise ValueError(\'negative amount for \'+ p[0] );
    return None;
d = {\"kiwi\":999};
 shelve(d,[(\"kiwi\",-2000)]);

