Skip to content

Instantly share code, notes, and snippets.

@mentix02
Last active November 23, 2018 06:37
Show Gist options
  • Save mentix02/afa1d27767c0291b1e487dad647c2d72 to your computer and use it in GitHub Desktop.
Save mentix02/afa1d27767c0291b1e487dad647c2d72 to your computer and use it in GitHub Desktop.
counts the words in a given file for college essays
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