Question
Question 13: Implement a function called charCombos from scratch that counts how many times each parameter z of letters occur sequentially in a string. For
Question 13: Implement a function called charCombos from scratch that counts how many times each parameter z of letters occur sequentially in a string.
For example, charCombos('abcbcb', z=2)
should return ab:1, bc:2, cb: 2
charCombos('abcbcb', z=3) should return
abc: 1, bcb: 2, cbc: 1
Show that this function works with the string abcbcb and one other string of your choice.
6 points
Question 14: In the traditional English language, students are taught
"Always use a 'u' after a 'q'!". Using the function from question 13 (won't get full credit otherwise) and a link to a dictionary of English words provided below to determine the percentage of times that 'q' is indeed immediately followed by a 'u'.
Specifically, words containing q that are immediately followed by a u divided by total number of words containing q. Hint: Ensure you don't count q followed by whitespace.
Note for words with multiple q's or multiple q-u's, count them once.
You should use the words_alpha.txt file found at https://github.com/dwyl/english-words/
You can download the whole repository by clicking on the green code button and choosing download ZIP
6 points
Question 15: Find the top 5 most commonly used letters after q that are NOT equal to u sorted in descending order of frequency. For example, assume q_words includes all words containing the letter q. You can modify CharCombos to help with this.
python language
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