by our code in the second casewe provide an argumentso the indexing of sys argv goes wellbut the conversion failssince python does not know how to convert the string to float this is different type of errorknown as valueerrorand we see that it is not treated very well by our except block we can improve the code by letting the except block test for different types of errorsand handling each one differentlyimport sys tryh float(sys argv[ ]except indexerrorprint('no command line argument for !'sys exit( abort execution except valueerrorprint( ' must be pure numbernot {sys argv[ ]}'exit( print( exp(- / )the following two examples illustrate how this more specific error handling worksterminal terminalpython altitude py no command line argument for hterminalpython altitude py the altitude must be pure numbernot " mof coursea drawback of this approach is that we need to guess in advance what could go wrong inside the try-blockand write code to handle all possible errors howeverwith some experiencethis is usually not very difficult python has many built-in error typesbut only few that are likely to occur and which need to be considered in the programs we encounter throughout this book in the code aboveif the try block would leads to different exception than what we catch in our except blockthe code will simply end with standard python error message if we want to avoid this behaviorand catch all possible exceptionswe could add generic except block such as exceptprint('something went wrong in reading input data!'exit(such block should be added after the except valueerror block in the code aboveand will catch any exception that is not an indexerror nor valueerror in this particular caseit can be difficult to imagine what kind of error that would bebut if it occursit will be caught and handled by our generic except block