Metode Ganda Ganda Python

# officially called as dunder methods
# mostly class in python is a subclass of objects which has dunder methods.

class Test:
  def __str__(self):
    return "This is just for test"
  def __add__(self, x):
    return 6 + x
  
sample = Test()
print(sample) # calls __str__, also gets called when str(sample)
print(sample + 9)  # calls __add__
  
# Refer this for many such methods: https://diveintopython3.net/special-method-names.html
Ranger