Skip to content

Instantly share code, notes, and snippets.

@paulbarbu
Created July 9, 2011 16:32
Show Gist options
  • Save paulbarbu/1073719 to your computer and use it in GitHub Desktop.
Save paulbarbu/1073719 to your computer and use it in GitHub Desktop.
Python Kitty
import kitty_class
def main():
jerry = kitty_class.Kitty("jerry")
jerry.watchCat()
jerry.nameCat("jerrard")
jerry.feedCat()
jerry.watchCat()
if __name__ == "__main__":
main()
class Kitty(object):
"""Kitty blueprint."""
def __init__(self, name):
self.name = name
self.__play = False
self.__eating = False
def playCat(self):
self.__play = not self.__play
def feedCat(self):
self.__eating = not self.__eating
def nameCat(self, name):
self.name = name
def watchCat(self):
print "{0} playing: {1}".format(self.name, self.__play)
print "{0} eating: {1}".format(self.name, self.__eating)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment