#!/usr/bin/env python
class SportsCar(object):
def __init__(self,make,colour):
self.make = make
self.colour = colour
self.horn = "BEEEEEEEEPPPPPPP"
def honk(self):
#now we can make some noise!
print self.make,' ',self.colour,' ',self.horn
print "Done "
mycar = SportsCar('Honda','silver')
#print mycar.make
#print mycar.colour
print mycar.honk()
print "Good Bye!!"
The output of the above code is given below.
Honda silver BEEEEEEEEPPPPPPP
Done
None
Good Bye!!
The first two lines of the output
Honda silver BEEEEEEEEPPPPPPP
Done
This is printed by mycar.honk().
I also understand the 4th line
Good Bye!!
I don't understand from where 'None' in the third line come from? Can someone please explain?
Also another related question
what is the difference between the declerations
class SportsCar:
and
class SportsCar(object):
I have been seeing both the declerations in different places.?