this try statement is another compound statementand follows the same pattern as if and while it' composed of the word tryfollowed by the main block of code (the action we are trying to run)followed by an except part that gives the exception handler code and an else part to be run if no exception is raised in the try part python first runs the try partthen runs either the except part (if an exception occursor the else part (if no exception occursin terms of statement nestingbecause the words tryexceptand else are all indented to the same levelthey are all considered part of the same single try statement notice that the else part is associated with the try herenot the if as we've seenelse can appear in if statements in pythonbut it can also appear in try statements and loops --its indentation tells you what statement it is part of in this casethe try statement spans from the word try through the code indented under the word elsebecause the else is indented the same as try the if statement in this code is one-liner and ends after the break supporting floating-point numbers againwe'll come back to the try statement later in this book for nowbe aware that because try can be used to intercept any errorit reduces the amount of error-checking code you have to writeand it' very general approach to dealing with unusual cases if we're sure that print won' failfor instancethis example could be even more concisewhile truereply input('enter text:'if reply ='stop'break tryprint(int(reply* exceptprint('bad! print('bye'and if we wanted to support input of floating-point numbers instead of just integersfor exampleusing try would be much easier than manual error testing--we could simply run float call and catch its exceptionswhile truereply input('enter text:'if reply ='stop'break tryprint(float(reply* exceptprint('bad! print('bye'there is no isfloat for strings todayso this exception-based approach spares us from having to analyze all possible floating-point syntax in an explicit error check when coding this waywe can enter wider variety of numbersbut errors and exits still work as before introducing python statements