>>Ximo> My question is how can show the execution error whitout exit of
>> the program, showing it in the error output as
>> Skip> You need to catch ZeroDivisionError. Here's a trivial example:
>>>>> try:
>>... 6/0
>>... except ZeroDivisionError:
>>... print "whoops!
"Skip Montanaro" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
>
>Ximo> And my question is how can show the execution error whitout exit
>Ximo> of the program, showing it in the error output as
>
> You need to catch ZeroDivisionError. Here's a trivial example:
>
>
Ximo wrote:
> Hello, I'm programing an advanced calculator, and I have many problems with
> the execution errors, specually with the division by 0.
>
> And my question is how can show the execution error whitout exit of the
> program, showing it in the error output as
Wrap the math in a try/ex
Ximo> And my question is how can show the execution error whitout exit
Ximo> of the program, showing it in the error output as
You need to catch ZeroDivisionError. Here's a trivial example:
>>> try:
... 6/0
... except ZeroDivisionError:
... print "whoops! divide by z
"Ximo" <[EMAIL PROTECTED]> writes:
> And my question is how can show the execution error whitout exit of the
> program, showing it in the error output as...
> >>6/0
> >>"Error: Division per 0"
Trap the ArithmeticError exception and go by the name of the exception
class. See the language ref manu