Guest User

Untitled

a guest
Jan 19th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. text = 'ABAABA'
  2.  
  3. d = {}
  4.  
  5. for b in text:
  6. d[b] = d.get(b, 0) + 1
  7.  
  8. print(d)
  9. {'A': 4, 'B': 2}
  10.  
  11. a = ["A","A","A","B","A","B"]
  12. b = set(a)
  13. c = {}
  14. for i in b:
  15. c[i] = a.count(i)
  16. print(c)
Add Comment
Please, Sign In to add comment