Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import collections
- def main():
- text = input("Enter the text to work with: ")
- from collections import defaultdict
- alphabet = defaultdict
- amount_found = count_occurences(text,alphabet)
- position_in_text = position_of_first(text,alphabet)
- print(amount_found, alphabet "found in", text)
- print(alphabet, "appears at position", position_in_text, "in", text)
- def count_occurences(text, alphabet):
- for i in text:
- if i == defaultdict:
- number += 1
- return number
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement