In [28]:
class Vehicles(object):
"""
Vehicles prototype to describe the cars.
Car name, it's price, and type i.e. van, convertible.
"""
global kind
kind = "car"
def __init__(self, name, nature, worth):
self.name = name
self.nature = nature
self.worth = worth
def describe(self):
"""
Returns construct of properties of the car.
"""
return "%s is a kind of %s %s and it's worth is US $%-6d" %(self.name, self.nature, kind, self.worth)
car1 = Vehicles("Fer", "red convertible", 60000)
car2 = Vehicles("Jump", "blue van", 10000)
print "\ncar1 object of the Vehicle class is, ",
print car1.__doc__
print "\ndescribe function of Vehicle class is, ",
print car1.describe.__doc__
print car1.describe()
print car2.describe()