Last active
November 23, 2018 06:37
-
-
Save mentix02/afa1d27767c0291b1e487dad647c2d72 to your computer and use it in GitHub Desktop.
counts the words in a given file for college essays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count(limit=350): | |
file = open('words.py', 'r+') | |
words = file.read().split() | |
length = len(words) | |
if length > limit: | |
print("word count over word limit") | |
print(f"words to cut down {length - limit}") | |
elif length <= limit: | |
print("word count adheres to word limit") | |
print(f"words to go {limit - length}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment