Question: Problem 2 Create a class named Bug with the following attributes and interface implementation: . Attributes: name - a string representing the name of this

Problem 2 Create a class named Bug with the following attributes and interface implementation: . Attributes: name - a string representing the name of this Bug object. position - a list with two elements, representing the location of the Bug object on the xy-plane. The first element represents the x-coordinate, while the second element represents the y-coordinate. Interface: . __init__(self, name, position = [0, 0]): constructor that initializes a Bug object with given name and position. If the position is not given, then the Bug's position is initialized at the origin. move_up(self, units): moves the position of this Bug object up by given number of units (int). move_down (self, units): moves the position of this Bug object down by given number of units (int). move_left(self, units): moves the position of this Bug object left by given number of units (int). move_right(self, units): moves the position of this Bug object right by given number of units (int). ___str__(self) : returns a string representation of this Bug object containing the name and position. The string should be formatted as follows: Name:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
