catch the ZeroDivisionError exception

PHOTO EMBED

Tue Jun 18 2024 02:37:17 GMT+0000 (Coordinated Universal Time)

Saved by @pynerds #python

try:
   
    print(1 / 0)

except ZeroDivisionError:
    print("You divided a number by 0.")
content_copyCOPY

https://www.pynerds.com/exception-handling-in-python/