I've written this code to divide two numbers. I am using exception handling and catching the error right but, I want to repeat the process, till the divisor is not given as 0 (zero) by the user.
def in_num():
a=int(input('Enter a number: '))
b=int(input('Enter another number: '))
return a,b
x, y=in_num()
try:
print(f'The Answer of {x}/{y} is {x/y}')
except ZeroDivisionError:
print('Cant divide by zero')
Now, if I give the 'b' as 0, it'll display the 'Cant divide by zero' error and it's done. I want to be able to repeat the Try and Except block till the user doesn't give 0 for 'b'!