What is the correct fix?
def safe_div(a, b):
if b == 0:
return None
return a / b
print(safe_div(10))
- Pass two args:
safe_div(10, 2) - Remove the
ifcheck - Change
/to// - Return 0 instead of None
safe_div requires two arguments but only one was given.