Question: Again read the precondition for second _ in _ list. The second requirement is that s contains at least three items separated by commas. How

Again read the precondition for second_in_list. The second requirement is that s contains at least three items separated by commas. How would we assert that? Another way to say this precondition is that s must contain at least two commas.
Look at the string functions in the IntroCS API. Do you see something to help you here? Add this assert statement and then try it out in the interactive shell.
codio@mike-panther:~/workspace/exercise2$ python
>>> import func
>>> func.second_in_list('apple')
If you did it correctly, this should crash and the first line of the error message should explicitly reference the line with the assert statement.

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 Programming Questions!