Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def friend_tree(ls):
- f=sum(ls,[])
- newdict={}
- for i in range(len(f)):
- if f.count(f[i]) > 1:
- newdict[f[i]]=f.count(f[i])
- elif f.count(f[i]) == 1:
- newdict[f[i]]=f.count(f[i])-1
- return newdict
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement