Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 2 . Reflect on Exercise 4 What we had you do with first _ vowel may seem weird. At first we had you return
Reflect on Exercise
What we had you do with firstvowel may seem weird. At first we had you return the length of the string if no vowel was found. Then we had you change it to at the very end. Why do it this way? Why not make a failed find return in the very beginning, especially since this is how the function findstr in introcs works?
You could have done it this way. You could have written your code as follows:
result # Nothing found yet
if something
do something
return result
skipping over each if statement if the vowel is not there.
But you would have to change your if statements a lot to account for this. And depending on your comfort with boolean expressions, you might find it harder to do it this way. What do you think?
Do you think our approach was easier than starting with Why or why not?
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