Function: penultimateUpper Input: (char) A 1xN vector containing the characters of a sentence Output: (char) A 1xN vector containing the characters of a modified sentence Function description: Write a function called penultimateUpper that takes in a sentence passed as a vector of characters and outputs a vector of characters where the second from last letter of each word is in upper case. Each word in the sentence will be at least 2 letters long. Examples: ans1 = penultimateUpper('this is simple') % ans1 = 'thIs Is simple' ans2 = penultimateUpper('the exam is easy peasy') % ans2 = 'tHe exAm Is eaSy peaSy'
Added by Elizabeth P.
Close
Step 1
First, we need to split the sentence into individual words. We can use the `split` function in MATLAB to do this. Show more…
Show all steps
Your feedback will help us improve your experience
John Bell and 101 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a program to fetch the words from the given list which have their first character in uppercase. namesList = ['Santa Maria', 'Hello World', 'Merry Christmas', 'Thank You'] Output: ['Maria', 'Hello', 'World', 'Merry', 'You']
Shelayah R.
QUESTION 1: Write a C program to take a string from the user consisting of one or more words separated by a single space, where each word consists of English letters, and store in a string title. Capitalize the string title by changing the capitalization of each word such that: If the length of the word is 1 or 2 letters, change all letters to lowercase Note: title consists of words separated by a single space without any leading or trailing spaces. Each word consists of uppercase and lowercase English letters and is non-empty. Otherwise, change the first letter to uppercase and the remaining letters to lowercase. Return the capitalized title QUESTION 2: What is the time complexity of capitalizing the string title of length n? Explain.
Aarya B.
Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. For coding simplicity, follow each output word by a comma, even the last one. Assume at least one word in the list will contain the given character. Assume that the list of words will always contain fewer than 20 words.
James K.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD