$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · easy · #25

What is the correct fix?

def safe_div(a, b):
    if b == 0:
        return None
    return a / b
print(safe_div(10))
  1. Pass two args: safe_div(10, 2)
  2. Remove the if check
  3. Change / to //
  4. Return 0 instead of None
safe_div requires two arguments but only one was given.
Play Problem Solving ▸