Question
5. Word Scrambling Read the following paragraph as quickly as you can, and see if you encounter any diculties. Aoccdrnig to rscheearch at an Elingsh
5. Word Scrambling Read the following paragraph as quickly as you can, and see if you encounter any diculties. Aoccdrnig to rscheearch at an Elingsh uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer is at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae we do not raed ervey lteter by itslef but the wrod as a wlohe. This has been presented as an example of a principle of human reading comprehension. If you keep the rst letter and the last letter of a word in their correct positions, then scramble the letters in between, the word is still quite readable in the context of an accompanying paragraph. However, it seems that this is a bit of a myth and not truly based on solid research.1 THE PROBLEM IS FOR YOU TO TO PROCESS A PARAGRAPH AS A STRING, SCRAMBLE THE INTERNAL LETTERS OF EACH WORD, AND THEN WRITE THE RESULTING PARAGRAPH TO A FILE. [HINT: Each word is separated by spaces so use .split() on the paragraph string. Handling punctuation is tricky. To deal with punctuation that comes at the end of a word (period, question mark, exclamation, etc.) you may use the following function: def ignorePunctuation ( a_word ) : """ Returns a new word with removed punctuation from end of a_word """ from string import punctuation idxEnd = -1 ch = a_word [ idxEnd ] while ch in punctuation : idxEnd -= 1 ch = a_word [ idxEnd ] return a_word [: idxEnd +1]
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