[Tutor] (no subject)

dn PyTutor at DancesWithMice.info
Tue Dec 8 04:56:13 EST 2020


On 08/12/2020 20:27, KNOW NEW wrote:
> Sir,
> I am a student of class 11. I am learning the Python Programming and I am
> trying to create a program in which I want to print "Infinite" when divisor
> is 0. But when I divide by 0, it gives Infinite but also print None. Now
> please advise me that what can I do to remove None and print only Infinite.
> Thank you
> Nikhil Yadav

Have you learned about Errors and Exceptions?
Wrap the division with try...except.
Look for the divide-by-zero error.
Print appropriately.
-- 
Regards =dn


More information about the Tutor mailing list