fork download
  1. temp=[2, 1, 3, 2, 1, 1, 1, 1, 1, 1]
  2.  
  3. counT=['h', 'i', ' ', 'o', 'w', 'a', 'r', 'e', 'y', 'u']
  4.  
  5. newList = [(2,'h'),(1,'i'),(1,'u')]
  6.  
  7. s="Hi how are you"
  8. s = s.lower()
  9. temp =[]
  10. counT=[]
  11. for i in range(len(s)):
  12. counter = s.count(s[i])
  13. if s[i] not in temp:
  14. temp.append(s[i])
  15. counT.append(counter)
  16.  
  17. newList = zip(temp,counT)
  18. newList = list(newList)
  19. print(newList)
Success #stdin #stdout 0.02s 9228KB
stdin
Standard input is empty
stdout
[('h', 2), ('i', 1), (' ', 3), ('o', 2), ('w', 1), ('a', 1), ('r', 1), ('e', 1), ('y', 1), ('u', 1)]