Skip to content
CodeKruPro

Two methods with the same name

Predict the outputMediumPython only
main.py
class Calc:
    def add(self, a, b):
        return a + b

    def add(self, a, b, c):
        return a + b + c

calc = Calc()
print(calc.add(1, 2, 3))
print(calc.add(1, 2))

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in