def division(n, d): return n / d if d else 0
Here is what the above code is Doing:
1. The function takes two arguments, n and d.
2. The function returns n / d if d is not 0.
3. If d is 0, the function returns 0.
def division(n, d): return n / d if d else 0
Here is what the above code is Doing:
1. The function takes two arguments, n and d.
2. The function returns n / d if d is not 0.
3. If d is 0, the function returns 0.