Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. text = """stagnating ; just as a small mountain brook, coming
  2. to a hollow, might stop, and sink from sight,
  3. through not having a will to find a way through that
  4. obstruction ; or around it. You will run across such
  5. a dormant town, occasionally; possibly so dormant
  6. that only outright isolation by a fast-moving world,
  7. will show it its folly. If you will tour Asia, Yuca-
  8. tan, or parts of Africa and Italy, you will find many
  9. sad ruins of past kingdoms. Go to Indo-China and
  10. visit its gigantic Ankhor Vat; call at Damascus,
  11. Baghdad and Samarkand. What sorrowful lack of
  12. ambition many such a community shows in thus dis-
  13. carding such high-class construction! And I say,
  14. again, that so will Youth grow dormant, and hold
  15. this big, throbbing world back, if no champion backs
  16. it up ; thus providing it with an opportunity to show
  17. its ability for looking forward, and improving un-
  18. satisfactory conditions."""
  19.  
  20. # count "e" in the text
  21. checkE = text.count("e")
  22. if checkE != 0:
  23. print (checkE)
  24. else:
  25. print("There is no e in the text")
  26.  
  27. # count overall characters
  28. overall = text.count("")
  29. print("overall count is:", overall)
  30.  
  31. # count letters in text only
  32. mod_text = []
  33. i = 0
  34. for x in text:
  35. if text[i].isalpha() == True:
  36. mod_text.append(text[i])
  37. i = i+1
  38. print(mod_text)
  39. overall_let = len(mod_text)
  40. print("overall letter count is:", overall_let)
  41.  
  42. # count AUIC in text
  43. AC = mod_text.count("a")
  44. UC = mod_text.count("u")
  45. IC = mod_text.count("i")
  46. OC = mod_text.count("o")
  47. print("The letter A appears :", AC, "times")
  48. print("The letter U appears :", UC, "times")
  49. print("The letter I appears :", IC, "times")
  50. print("The letter O appears :", OC, "times")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement