Write a function which takes as parameter a character string x composed of a combination of four words: 'bed', 'lamp', 'desk', 'phone'. The function must calculate the percentage of each word. The...


Write a function which takes as parameter a character string x<br>composed of a combination of four words: 'bed', 'lamp', 'desk',<br>'phone'.<br>The function must calculate the percentage of each word.<br>The function must print (print) these four percentages of letters<br>words rounded to two decimal places. To make this display,<br>multiply each percentage by 100 and round this to 2 decimal<br>places.<br>• Then it is necessary to display (print) a single message<br>indicating the median. A grade (word) is median if at least 1/2<br>(half) of the students obtained that grade or better. So, If at least<br>1/2 (half) of the letters are bed ': display Median is bed. If not, then<br>if at least 1/2 of the letters are bed ', lamp': display Median is lamp<br>2. If not, then if at least 1/2 of the letters are bed, lamp, desk: print<br>

Extracted text: Write a function which takes as parameter a character string x composed of a combination of four words: 'bed', 'lamp', 'desk', 'phone'. The function must calculate the percentage of each word. The function must print (print) these four percentages of letters words rounded to two decimal places. To make this display, multiply each percentage by 100 and round this to 2 decimal places. • Then it is necessary to display (print) a single message indicating the median. A grade (word) is median if at least 1/2 (half) of the students obtained that grade or better. So, If at least 1/2 (half) of the letters are bed ': display Median is bed. If not, then if at least 1/2 of the letters are bed ', lamp': display Median is lamp 2. If not, then if at least 1/2 of the letters are bed, lamp, desk: print "The median is desk", otherwise print "The median is phone".

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here