Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def findLabel(labels,deeds,needs):
- newNeeds = []
- for i in needs:
- newNeeds.append(i.split())
- d = {}
- for i in range(len(labels)):
- d[labels[i]] = []
- for j in newNeeds[i]:
- d[labels[i]].append(j)
- for i in d:
- num = 0
- for j in deeds:
- if j in d[i]:
- num +=1
- if num == len(d[i]):
- return i
- return "nobadge"
- labels = ['first', 'second', 'third', 'fourth']
- deeds = ['code', 'talk', 'plan', 'run']
- needs = ['code talk plan think', 'talk plan run ', 'plan run code think', 'run code talk think']
- print(findLabel(labels,deeds,needs))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement