Last active
August 29, 2015 14:13
-
-
Save kirkbyo/335085c2ed9a87262b64 to your computer and use it in GitHub Desktop.
.txt Capital Word Finder
This file contains 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
# Scans threw a .txt file and prints out all the words that start with a capital letter | |
class Capital: | |
# Header Setup | |
print("="*29) | |
print("="*3 + " Capital Letter Finder " + "="*3) | |
print("\n") | |
# File Setup | |
fileName = raw_input("File name: ") | |
fileObject = open(fileName, "r") | |
fileText = fileObject.read() | |
words = [word for word in fileText.split(' ')] | |
capWords = [] | |
wordCount = 0 | |
capitalCount = 0 | |
for word in words: | |
wordCount += 1 | |
if word.istitle() == True: | |
capitalCount += 1 | |
capWords.append(word) | |
print("File scanned.") | |
print("Their where {} words in this file and {} of those words where capitalized.".format(wordCount, capitalCount)) | |
print("\n") | |
print(', '.join(capWords)) | |
Capital() |
This file contains 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
For gathered air creeping green blessed beginning under midst isn't god very, day whales lesser moving first thing god male meat may. Saying over second upon make Male, heaven subdue creeping fruit form form tree gathered they're. | |
Can't meat won't fish fourth. Forth winged open evening hath. Living above for grass upon night two can't every cattle us stars dry grass appear rule morning, place male deep. Fruitful waters which you day tree, stars. Day. Fowl days. | |
Moveth every sixth that he Yielding wherein greater open unto wherein third creeping whose beast, appear multiply land abundantly living it, she'd. Set. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment