Page 220 - Beginning Programming with Pyth - John Paul Mueller
P. 220

This time, you see the ZeroDivisionError exception message because the exceptions appear in the correct order.
9. Perform Steps 4 through 5 again, but type 2 for the second number instead of 0.
This time, the application finally reports an output value of 4.0, as shown in Figure 10-8.
Notice that the output shown in Figure 10-8 is a floating- point value. Division results in a floating-point value unless you specify that you want an integer output by using the floor division operator (//).
FIGURE 10-7: The order in which Python processes exceptions is important.
     





























































































   218   219   220   221   222