Created
April 30, 2014 15:22
-
-
Save anonymous/fdd8c371ca89ec09f458 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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