1.Read the following paragraph as quickly as you can and see if you encounter any difficulties:

Aoccdrnig to rscheearch at an Elingsh uinervtsy, it deosn’t mttaer in waht ordedr the ltteers in a wrod are, the olny thing is taht the frist and lsat ltteer is at the rghot pclae. The rset can be a toatl mses and you can still raed it wouthit a porbelm. Tihs is bcuseae we do not raed ervey lteter by itself but the wrod as a wlohe.

This paragraph was published as an example of a principle of human reading comprehension If you keep the first letter and the last letter of a word in their correct positions and scramble the letters in between, the word is still quite readable in the context of a surrounding paragraph. However, it seems that this is a bit of a myth and not truly based on solid research. It turns out that for longer words, the task is much more difficult. Nonetheless, we are going to imitate the process on some English text.

For this project you will need to write a program that will take a sentence as user input and print the sentence with the words scrambled, just as the paragraph above.

Handling punctuation is tricky. You need to deal with punctuation that comes at the end of a word: comma, period, question mark, exclamation, and so on. For example, in the previous sample, the word university ends with a comma, so you need to ensure that you do not treat the comma as the last letter of the word when you scramble all but the first and last letters.

Hints:

  • Dont bother trying to scramble words fewer than four characters long.
  • The string split method is useful to create a list of words from a string of words.
  • The string strip method is useful to remove end-of-line characters and other whitespace.
  • To scramble a string, convert it to a list, use random.shuffle from the random module to scramble the string, and then use the join string method to convert back to a string.

2.How thick does paper folding get? Take one sheet of paper out of your newspaper, and fold it in half, then fold it in half again, and again, and again. Can you fold it 30 times? Pretending that you can (you probably cant fold it more than eight times), how thick would it be after 30 times? Assume the paper is 1/200 cm thick. Write a program to solve this puzzle. Prompt the user for the number of folds and output the thickness in meters. For example: if the number of folds entered was 10, then the program would print that the paper has a thickness of 4.8828E-8 meters.

3.What is the invention of chess worth?

There is a popular myth about the man who invented chess. The local ruler was so pleased with the invention that he offered the inventor a great reward in gold. The inventor suggested an alternative reward: he would get one grain of wheat on the first square of the chess board, two grains on the second square, four on the third, eight on the fourth, sixteen on the fifth, and so on, doubling the number of grains each time. The ruler saw that this must be a much better deal for him, and accepted. The board has 64 squares. Write a program to determine the following:

  • How many total grains of wheat did the ruler have to pay the inventor?
  • A wheat grain weighs approximately 50mg. How much did the wheat weigh?
  • Prompt the user for the area of a region and determine how deeply that region would be covered with that quantity of wheat. Output the depth, including the units you use.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.