Interview Question (25!11!2024)
Interview Question (25!11!2024)
class Calculator:
def add(self, a, b=0, c=0):
return a + b + c
calc = Calculator()
print(calc.add(5)) # 5
print(calc.add(5, 3)) # 8
print(calc.add(5, 3, 2)) # 10
class Dog(Animal):
def sound(self):
return "Dogs bark"
class Cat(Animal):
def sound(self):
return "Cats meow"
dog = Dog()
cat = Cat()