answered 2 years ago
You can just can try / and if there is an exception, do // instead - like:
try: result = x / y except ZeroDivisionError: result = x // y