Do not write on this question sheet – write only on the ...
Do not write on this question sheet – write only on the answer sheet. Please write legibly, and if your indentation might be confusing, use some symbols to indicate where you’ve indented.
This test is out of 100 points, with and additional 10 points extra credit.
1. (25 points) Create a function called NoPunc(s) which will be given a string containing words along with punctuation. Remove all punctuation from the string (leave the spaces, though) and return the resultant string. The punctuation symbols you need to worry about are: period, comma, colon, semi-colon, question-mark and exclamation-mark.
2. Now that you’ve removed all punctuation from the string, we’re interested in the words. Some of them are long, some are short. There may be a few words that are the longest (for instance, 15 characters), and perhaps many words which are the second longest (say, 13 characters, assuming that there are no words with 14 characters).
For instance, if the string is: “Now is the time for all Python freaks to be clearly worried”, the longest words are “clearly” and “worried”, and the second longest words are “Python” and “freaks”.
2a) (10 points) Create the function LongestWords(s) which will return a list of all the longest words in s. For instance, for the string in the example above, it will return [‘clearly’,’worried’].
2b) (15 points) Create the function SecondLongestWords(s) which will return a list of all the words in s, which are second longest. For instance, for the string in the example above, it will return [‘Python’,’freaks’].
3. (25 points) You and your friend, Voldy, are each given a gadget that’s similar to a compass. It gives a digital readout, in whole number degrees, showing which direction you’re headed. Let’s say you’re facing North when you turn it on – it will immediately show “0”. As you turn clock-wise, the numbers will increase, so that when you are facing East, it shows “90”, and when you reach South, it shows “180”, and then West: “270” and North again: “360”. If you keep turning clockwise, the numbers will keep increasing, so that if you reach East again, it shows “450”, etc. When reversing your direction – turning counter-clockwise – the gadget’s numbers decrease. In fact, it may become negative (say “-90” when facing West). Assume that you’re both facing North when you turn on your gadgets (so the initial readings are both “0”).
Create the function MinDiff(mine,his) that is given the readouts from my gadget and his, and returns the (minimum) angle difference between our two headings. This number is the measure of the minor arc between the headings.
It will be in the range 0 ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- list of greek and latin roots in english
- floss word list make take teach
- 2 o 2 1 scripps national spelling bee
- 2 265 most frequent words in spoken english
- long vowel sounds word lists make take teach
- examples of long vowel words yourdictionary
- do not write on this question sheet write only on the
- intervention strategy mccsc
- com
- packing for the longest journey museum of london
Related searches
- how to write a research question examples
- do or do not no try
- products not on the market
- do not want pin on windows 10
- the light dependent reactions do not produce
- cool things to do on the internet
- how to do well on the gmat
- do i have word on this computer
- things to do on the internet
- where is the camera on this computer
- how do you scanner on this computer
- how to write a picot question nursing