Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. def wordCount(filename):
  2. fopen = open(filename, "r")
  3.  
  4. count = 0
  5.  
  6. for line in fopen:
  7. for ch in line:
  8. if (ch == " "):
  9. count = count + 1
  10. fopen.close()
  11. return count
  12.  
  13.  
  14. print (wordCount("dracula.txt"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement