1. I have to write a function based on a open file that has one lowercase word per line. I have to return a dictionary with keys in single lowercase letters and each value is a list of the words from the file that starts with that letter. (the keys in the dictionary are from only the letters of the words that appear in the file)
Can someone help me create the above function? Thanks!
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
2. In the provided dictionary, all keys consist of a single lowercase letter and each value is a list of lowercase words starting with the letter. Return a new dictionary with each key a single lowercase letter and each value the number of lowercase words that start with that letter.
I don't get this one too. Like I don't know how to incorporate the for/while loops and/or is statements...
The Python docs give good examples/explanations of what you need to do these problems. The for loop was the funkiest part, and that just Pythonic:
for theWord in the File:
These problems are basically identical. The functions, with error checking, are about 11 lines of code.
We're not supposed to give people the code for their assignments, so last night's and tonight's answers are the best I'm allowed to do.