Created
December 10, 2015 16:35
-
-
Save jherrlin/41bdaf25fae274210a97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car(object): | |
def __init__(self, color, gears): # This is the constructor with 2 arguments as input | |
self.color = color # This is object attribute | |
self.gears = gears | |
print('Color is : {}'.format(self.color)) # Prints when constructor is called | |
print('Number of gears: {}'.format(self.gears)) | |
car1 = Car('Yellow', 5) # Create a new instance of Car |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment