-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobot.py
36 lines (27 loc) · 805 Bytes
/
Robot.py
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
27
28
29
30
31
32
33
34
35
36
class Robot:
def __init__(self, name, colour, weight):
self.name = name
self.colour = colour
self.weignt = weight
def introduce_self(self):
print("")
print("My name is " + self.name)
class Person:
def __init__(self, name, personality, is_sitting):
self.name = name
self.personality = personality
self.is_sitting = is_sitting
def sit_down(self):
self.is_sitting = True
def stand_up(self):
self.is_sitting = False
r1 = Robot("Tom", "red", 30)
r2 = Robot("Jerry", "blue", 40)
r1.introduce_self()
r2.introduce_self()
p1 = Person("aakash", "Nice", False)
p2 = Person("Dhaval", "Aggressive", True)
p1.robot_owned = r2
p2.robot_owned = r1
p1.robot_owned.introduce_self()
p2.robot_owned.introduce_self()