Question: implement a function that takes a string consisting of words separated by single spaces and returns a string containing all those words but in the
implement a function that takes a string consisting of words separated by single spaces and returns a string containing all those words but in the reverse order and such that all cases of letters in the original string are swapped, ie lowercase letters become uppercase and uppercase letters become lowercase.Examplesentence "rUns dOg"Reverse the word order and swap the case of all letters, then return the string "DoG RUNS".Function descriptionComplete the function reversewordsorderandswapcases in the editor below.The function has the following parameter:string sentence: a given string of spaceseparated wordsReturns:string: a string containing all the words from the sentence but in the reverse order and such that all cases of letters in the sentence string are swapped.Constraints sentence contains only English letters and spaces. sentence begins and ends with a letter. There are no two consecutive spaces in sentence. There are at most words in sentence. The lengths of each of the words is at most
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
