I was trying to do mrynit's bob, bill and joe thingie, but it doesn't append the last elif person
bob=['hammer', 'saw']
joe=['saw', 'drill', 'leveler']
bill=['hammer', 'leveler']
everyone=[bob, joe, bill]
countOverall=len(bob)+len(joe)+len(bill)
everyoneString=' '.join(bob+joe+bill)
def toolcount(tool):
count=0
finding=everyoneString.find(tool)
while finding!=-1:
count+=1
start=finding+1
finding=everyoneString.find(tool, start)
return count
def whoowns(tool):
owners=[]
if ' '.join(bob).find(tool)!=-1:
owners.append('bob')
elif ' '.join(bill).find(tool)!=-1:
owners.append('bill')
elif ' '.join(joe).find(tool)!=-1:
owners.append('joe')
print owners
whoowns('leveler')