Skip to content

Instantly share code, notes, and snippets.

Created April 30, 2014 15:22
Show Gist options
  • Save anonymous/fdd8c371ca89ec09f458 to your computer and use it in GitHub Desktop.
Save anonymous/fdd8c371ca89ec09f458 to your computer and use it in GitHub Desktop.
orders = fileOps.openCsv1("cases.csv")
values = []
similarOrders = {}
custID = raw_input('__Enter customer ID:')
for key,val in orders.iteritems():
if custID == key:
values = val
for key,val in orders.iteritems():
if custID != key:
s1 = set(values)
s2 = set(val)
extraProducts = [x for x in s2 if x not in s1]
similarProducts = [x for x in s2 if x in s1]
print "There are",len(similarProducts),"similar Products to ",
print custID," in order:",key," they are :",similarProducts
print "extra products are:",extraProducts
similarOrders[key] = len(similarProducts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment