Question
PY. TEMPLATE BELOW : This is your template. Implement all solutions in the appropriate function / class. You are encouraged to implement you own
PY. TEMPLATE BELOW :
"""
This is your template. Implement all solutions in the appropriate
function / class. You are encouraged to implement you own helper functions
as
needed with a short (one-line) description of their purpose.
Hint: copy and paste the function descriptor format from lab1.py to save
time.
"""
class Robot:
""" implement this class below with appropriate function descriptors
"""
def __init__(self, safety_word, pos):
self.pos_x = pos[0]
self.pos_y = pos[1]
self.safety_word = safety_word
def beep():
pass
def raise_alarm(self, n):
pass
def emote(self):
pass
def move(self, vector):
pass
class Cyborg(Robot):
""" implement this class below with appropriate function descriptors
"""
def __init__(self, name, mood, safety_word. pos):
Robot.__init__(self, safety_word, pos)
self.name = name
self.mood = mood
def emote(self):
pass
def announce_move(self, pos_old, pos_new):
pass
def move(self, vector):
pass
1. Robot Class Finish implementing the Robot Class in the provided Python file. Variables and function descriptions have been provided below. Variables str: safety_word The phrase our robot uses to indicate danger float: pos_x The x coordinate of our robot's current position float: pos_y The y coordinate of our robot's current position Functions beep0) Prints "beep" to screen raise_alarm(self, n) Prints the robot's safety word n times to screen with a 1s pause between each print emote(self) Does nothing since robots generally can't emote move(self, vector) Moves the robot by the distances specified by the input vector (a tuple) e.g. if original pos is (4, 5) and move(1,-2)) is called, our robot's new pos is (5, 3)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started