python_data_scien/poc2/poc2_mini_proj_2.py
def intersect(list1, list2):
    """
    Compute the intersection of two sorted lists.

    Returns a new sorted list containing only elements that are in
    both list1 and list2.

    This function can be iterative.
    """
    result_list = []
    idx1 = 0
    idx2 = 0
    while idx1 < len(list1) and idx2 < len(list2):
        if list1[idx1] == list2[idx2]:
            result_list.append(list1[idx1])
            idx1 += 1
            idx2 += 1
        elif list1[idx1] < list2[idx2]:
            idx1 += 1
        elif list1[idx1] > list2[idx2]:
            idx2 += 1
        else:
            print 'error in func intersect!!!'
            return
    return result_list

    Compute the intersection of two sorted lists.

    Returns a new sorted list containing only elements that are in
    both list1 and list2.

    This function can be iterative.
    
Compute the intersection of two sorted lists.
Returns a new sorted list containing only elements that are in
both list1 and list2.

This function can be iterative.
Compute the intersection of two sorted lists . Returns a new sorted list containing only elements that are in both list1 and list2 . This function can be iterative .
def intersect(list1, list2):
    result_list = []
    idx1 = 0
    idx2 = 0
    while idx1 < len(list1) and idx2 < len(list2):
        if list1[idx1] == list2[idx2]:
            result_list.append(list1[idx1])
            idx1 += 1
            idx2 += 1
        elif list1[idx1] < list2[idx2]:
            idx1 += 1
        elif list1[idx1] > list2[idx2]:
            idx2 += 1
        else:
            print 'error in func intersect!!!'
            return
    return result_list
def intersect ( list1 , list2 ) : result_list = [ ] idx1 = 0 idx2 = 0 while idx1 < len ( list1 ) and idx2 < len ( list2 ) : if list1 [ idx1 ] == list2 [ idx2 ] : result_list . append ( list1 [ idx1 ] ) idx1 += 1 idx2 += 1 elif list1 [ idx1 ] < list2 [ idx2 ] : idx1 += 1 elif list1 [ idx1 ] > list2 [ idx2 ] : idx2 += 1 else : print 'error in func intersect!!!' return return result_list
Compute the intersection of two sorted lists.
Compute the intersection of two sorted lists .
"""
    Compute the intersection of two sorted lists.

    Returns a new sorted list containing only elements that are in
    both list1 and list2.

    This function can be iterative.
    """
list1
list2