Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in python code, please help Exercise 3 This program will make use of a function to do some simple manipulations on strings. a) Start by
in python code, please help
Exercise 3 This program will make use of a function to do some simple manipulations on strings. a) Start by creating a function called stringManipulation with one argument sentence. The function will just return the argument at this stage. This is called a stub in programming, which means just creating a function with the right arguments and returning anything in the development phase. In the main program just call the function with some input from the user to check that it works. See sample below: Enter something: test You entered test b) Change the function so that it prints the letters of the argument one per line before returning the argument. See below sample run: Enter something: test t e t You entered test c) Change the function again so that it does not print anything but returns the letters of the argument separated by spaces. See below sample run: Enter something: test Modified text: t e st d) Change the function again so that it returns the index of each character followed by the character, as in the sample below: Enter something: test Modified text: Otlezs3t e) Change the function so that it returns the characters in even positions in upper case and the characters in odd positions in lower case, as in the sample below: Enter something: test Modified text: Iest. f) Change the function so that it returns in addition to the modified text as in the cesvieus question, the number of vowels in the argument, as in the sample below: Enter something: test Modified text: IeSt It includes: 1 vowels. B) Add one more functionality to the stringManipulation which is to return the middle character. If the number of tharacters in the argument is odd then the middle character is well defined, if the number of characters is even then return the two characters which are in the middle, as in the samples below: Enter something: test Modified text: Test. It includes: 1 yoiels. Mid character: it. Modified text: bulsisexs. It includest: BullS. EyE Mid character: 3 vowels. Mid character: s Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started