Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. def findLabel(labels,deeds,needs):
  2. newNeeds = []
  3. for i in needs:
  4. newNeeds.append(i.split())
  5. d = {}
  6. for i in range(len(labels)):
  7. d[labels[i]] = []
  8. for j in newNeeds[i]:
  9. d[labels[i]].append(j)
  10. for i in d:
  11. num = 0
  12. for j in deeds:
  13.  
  14. if j in d[i]:
  15. num +=1
  16. if num == len(d[i]):
  17. return i
  18.  
  19. return "nobadge"
  20.  
  21.  
  22.  
  23. labels = ['first', 'second', 'third', 'fourth']
  24. deeds = ['code', 'talk', 'plan', 'run']
  25. needs = ['code talk plan think', 'talk plan run ', 'plan run code think', 'run code talk think']
  26. print(findLabel(labels,deeds,needs))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement