-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path13_objects_fun.py
More file actions
26 lines (20 loc) · 772 Bytes
/
Copy path13_objects_fun.py
File metadata and controls
26 lines (20 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# The classic animal sample
class Cat():
"""A simple attempt to be an amazing a cat."""
def __init__(self, name, age):
"""Initialize name and age attributes."""
self.name = name
self.age = age
def sit(self):
"""Simulate a dog sitting in response to a command."""
print(self.name.title() + ", \"seriosly? I'm a cat!\".")
def roll_over(self):
"""Simulate rolling over in response to a command."""
print(self.name.title() + ", rolled in position to scratch!")
my_cat = Cat('maru', 6) # name and age
print("My cat name is " + my_cat.name.title() + ".")
print("My cat is " + str(my_cat.age) + " years old.")
print("Hey cat! SIT!")
my_cat.sit();
print("Hey cat! Do a roll over!")
my_cat.roll_over();