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

Which fix removes the bug?

def greet(self, name):
    return "Hi " + name

class Greeter:
    greet = greet
  1. Define greet inside the class body
  2. Define greet after the class body
  3. Rename the self parameter to cls
  4. Return name without the greeting
A method belongs in the class body; assigning a stray function is fragile and confusing.
Play Problem Solving ▸