Question
QUESTION 3 For this question, you'll need to download the textfile that is mentioned in Chapter 9 of Think Python. The list contains 113,809 valid
QUESTION 3
For this question, you'll need to download the textfile that is mentioned in Chapter 9 of Think Python. The list contains 113,809 valid crossword puzzle words and is an excellent resource for finding all the words that meet a specific criteria. Right click (or Control click on a Mac) on this link and then save it in the location where your Python files are located as words.txt. Then, open a new Python file and start by typing the following two lines, which will give you a list with each word as a string (note that, if your searches ever get too slow, you could convert the list to a set using wordset = set(wordlist), but I think a list should work fine.)
with open("words.txt", "r+") as f: wordlist = f.read().splitlines()
Now, you'll need to add some additional code in order to answer the following question:
"What 9-letter word has the second letter 'a', fifth letter 'e', and seventh letter 'g'?"
Note: There's only one such word in this entire list!
QUESTION 5
Using the same wordlist and starter code from Question 3, answer the following question:
"How many words on this wordlist begin and end with the letter a?"
Hint: It's quite a few, so be sure to find a way for your code to do the counting instead of you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started