Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import collections
  2.  
  3. def main():
  4. text = input("Enter the text to work with: ")
  5. from collections import defaultdict
  6. alphabet = defaultdict
  7.  
  8. amount_found = count_occurences(text,alphabet)
  9. position_in_text = position_of_first(text,alphabet)
  10.  
  11. print(amount_found, alphabet "found in", text)
  12. print(alphabet, "appears at position", position_in_text, "in", text)
  13.  
  14. def count_occurences(text, alphabet):
  15. for i in text:
  16. if i == defaultdict:
  17. number += 1
  18. return number
  19.  
  20. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement