silencing error sometimes it is undesirable to display the error messages of the except blocks in such caseswe want to silent the error messageswhich is discussed in this section firstundo the changes made in previous sectioni replace 'integerwith 'intand 'exceptionwith 'valueerrornowwe will consider the following three cases to handle the error silent do not display error message warn display the error message stop stop execution of codeif error is detected for this one positional argument 'modeis definedwhose default value is set to 'warn'and then put the 'printstatement inside the 'if-elseblock it is good idea to set the default value of 'modeto 'warnas we do not want to pass the error silently listing silencing error price py import csv warn is kept as defaultas error should not be passed silently def ring_cost(filenamemode='warn')''calculate the total cost ''total_price for all items in the list with open(filename' 'as fopen file in read mode rows csv reader(fheader next(rowsskip line header for row_numrow in enumerate(rowsstart= )start from not tryrow[ float(row[ ]price row[ int(row[ ]quantity except valueerror as errprocess valueerror only if mode ='warn'print("invalid datarow is skipped"print('row{}reason {}format(row_numerr)elif mode ='silent'pass do nothing elif mode ='stop'raise raise the exception continue total_price +row[ row[ print("total price % ftotal_pricereturn total_price return total_price def main()total ring_cost('price csv'function call print("total price % totalprint value standard boilerplate main is the starting function if __name__ ='__main__'main(below are the outputs for each of the cases code-block:python from price import ring_cost ring_cost('price_missing csv'default 'warn(continues on next page silencing error