Skip to content

Instantly share code, notes, and snippets.

@wblxyxolbkhv
Created November 30, 2019 08:12
Show Gist options
  • Save wblxyxolbkhv/d207ef8b12a521e4dc67510ea6160763 to your computer and use it in GitHub Desktop.
Save wblxyxolbkhv/d207ef8b12a521e4dc67510ea6160763 to your computer and use it in GitHub Desktop.
Cats cats cats
class Cat:
def __init__(self,
name,
color):
self.name = name
self.color = color
self.is_dirty = False
def sleep(self):
print('Cat {} zzzzZZZZ'.format(self.name))
def eat(self, food):
print('Cat {} eat {}'.format(self.name, food))
def talk(self):
print('Cat {} say Meow!'.format(self.name))
def get_color(self):
if self.is_dirty:
print('Cat {} dirty'.format(self.name))
else:
print('Cat {} {}'.format(self.name, self.color))
tom = Cat(name='Tom', color='gray')
keks = Cat(name='Keks', color='black')
maria = Cat(name='Maria', color='red')
tom.sleep()
keks.sleep()
maria.sleep()
tom.eat(food='hedgehog')
keks.eat(food='keks')
maria.eat(food='meat')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment