$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · medium · #129

What is the correct fix?

def scale(v, factor):
    return v * factor

print(scale(factor=2))
  1. Pass both: scale(3, factor=2) in the call
  2. Pass both: scale(factor=2, 3) in the call
  3. Give v a default value in the signature
  4. Swap the two parameters in the signature
v has no default, so omitting it raises TypeError for a missing argument.
Play Problem Solving ▸