Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def analyze_text(text):
- letter_count = 0
- alphas = 0
- for c in text:
- if c == "e" or c == "E":
- letter_count += 1
- if c.isalpha():
- alphas += 1
- ans1 = "The text contains {0} alphabetic characters, of which {1} ({2}%) are 'e'."
- return ans1.format(alphas, letter_count, float(letter_count / alphas * 100))
Add Comment
Please, Sign In to add comment