Question: Once you have written this expression, you will need assignment stubs to keep the function from crashing. Again, we are going to use our test

Once you have written this expression, you will need assignment stubs to keep the function from crashing. Again, we are going to use our test cases to guide us. Notice the positions of the commas in "apple, banana, orange". The first one is at position 5 and the second one is at position 13. In fact, the commas in Billy, Andrew, Taylor are at the exact same positions.
Create two variables for the two comma positions, and assign the first one the value 5, and the second one the value 13. Then use these variables to slice the input string and assign the result to our slice variable.
We called the variable slice because that is what we need to do now. Ultimately, the value you will be returning will be cut from the original string s. Once you slice properly, the function should not work just on the string "apple, banana, orange", but also on the string "Billy, Andrew, Taylor". You should replace the right hand side of the assignment stub for slice with an expression slicing s.
This step is a little more complicated. Think about how we are slicing. We are slicing from one comma to another (not including the commas). As a result, this expression is going to require two new variables.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!