Python Program to Convert Km to Meter using Operator Overloading

class Distance_m:
def __init__(self, m):
self.m=m
def display(self):
print("Distance in metre is :", self.m)
def mts(D):
return D.km*1000
class Distance_km:
def __init__(self, km):
self.km=km
def display(self):
print("Distance in KM is :", self.km)
def km(D):
return D.m/1000
Dm=Distance_m(7000)
Dm.display()
print("Distance in KM is :", km(Dm))

Output:
Python Program to Convert Km to Meter using Operator Overloading