# -*- coding: cp1252 -*-
# list_intersection.py
# MIT OCW 6.189 Homework 3
# Exercise 3.1 – Additional List Practice
# Mechanical MOOC
# Written for Python 3
# Judy Young
# July 23, 2013
# Return a list that gives the intersection of the two lists
# ie, a list of elements that are common to both lists.
 
def list_intersection(list_1, list_2):
    new_list = []
    for item in list_1:
        if item in list_2:
            new_list.append(item)
    return new_list

print list_intersection([1, 3, 5], [5, 3, 1])
print list_intersection([1, 3, 6, 9], [10, 14, 3, 72, 9])
print list_intersection([2, 3], [3, 3, 3, 2, 10])
print list_intersection([2, 4, 6], [1, 3, 5])
print list_intersection([1, 1, 2, 3, 5, 8, 13], [1, 3, 5, 7, 9, 11, 13])
print list_intersection([1, 3, 5, 7, 9, 11, 13], [1, 1, 2, 3, 5, 8, 13])
    