Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

16. Add the First Error Message You should add an error message to the first assert statement. This error message should tell the user that

16. Add the First Error Message You should add an error message to the first assert statement. This error message should tell the user that the argument is not a string. For example, if you call second_in_list(12) then the last line of the error message should be AssertionError: The value 12 is not a string. And if you call second_in_list(True) then the last line should be AssertionError: The value True is not a string. Remember, you do not need to include "AssertionError: " in your error message. That is included automatically. But you do need to add everything else.

(please no if, else, or loops)

image text in transcribed

16. Add the First Error Message You should add an error message to the first assert statement. This error message should tell the user that the argument is not a string. For example, if you call second_in_list(12) then the last line of the error message should be func.second_in_list(12) Traceback (most recent call last): AssertionError: The value 12 is not a string. File "", line 1 , in File "/home/codio/workspace/exercise3/func.py", line 27 , in second_in_list assert type(s) == str, 'The value ' +str(s)+ is not a string.' AssertionError: The value 12 is not a string. And if you call second_in_list(True) then the last line should be > func.second_in_list(True) Traceback (most recent call last): Assertionerror: The value True is not a string. File "", line 1 , in File "/home/codio/workspace/exercise3/func.py", line 27, in second_in_list assert type(s) == str, 'The value '+str(s)+' is not a string.' AssertionError: The value True is not a string. Remember, you do not need to include "AssertionError: " in your error message. That is included D automatically. But you do need to add everything else. Check the Error Message You may run this test multiple times. LAST RUN on 2/13/2023, 11:43:29 AM The error message uses str() and not repr() as directed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

How do amplifiers differ from repeaters?

Answered: 1 week ago

Question

Explain the forces that influence how people handle conflict

Answered: 1 week ago