EDIT
No longer getting list error after making suggested changes but still not returning any matches. Code now:
# all ingredients, represented by numbers: 0= empty selection 1=rice 2=spice 3=vegetable
allIng = [0,1,2,3]
#Each individual recipe(r)
# Veggie Rice Balls
r1 = (0,1,3)
# Curry Rice
r2 =(0,1,2)
# Herb Sauté
r3 = (0,2,3)
# Vegetable Curry
r4 = (1,2,3)
# all recipes on one list
allRec = [r1,r2,r3,r4]
#ingredients picked
iP = []
#ingredient count
iC = 1
#User given option to pick up to 3 ingredients
while iC <= 3:
pitem = int (input ("Pick up to 3 items "))
if pitem in allIng:
iP.append(pitem)
print(iP)
iC += 1
else:
print ("Incorrect entry, please pick again")
#sort list
iP.sort()
tuple(iP)
#compare iP to allRec looking for matches
if iP in allRec:
matches = set (iP) & set(allRec)
print ("Matches:",matches)
Trying to get it print out which recipe matched and if possible tag the name of the recipe itself.
set(allRec)isset([r1,r2,r3,r4])which isset([[0,1,3], ...]). It is readingr1as[0, 1, 3], and that's a list which isn't hashable and therefore not a valid member of a set.set(r1)isset([0, 1, 3]), which is making a set containing integers. Integers are immutable, hashable, valid set members.