Is there any way to do this without a lot of try/excepts? I have more than 30 divisions and my code is very long with all try/except
def test():
a = 12
b = 0
c = 43
d = 0
try:
w = a / b
except Exception:
w = 'cant'
try:
x = b / c
except Exception:
x = 'cant'
try:
y = c / d
except Exception:
y = 'cant'
print(w)
print(x)
print(y)