Text: Hi, please help me code this in Python!
Question 2 (Robot Class: Simple Methods)
The second task is to write methods that will allow us to interact with the values of a robot's attributes. Specifically, we will write the following methods in our implementation of the Robot class:
- A method named get_name that will return the value of the instance variable name.
- A method named get_phrase that will return the value of the instance variable phrase.
- A method named set_phrase that will set the value of the instance variable phrase to its input argument.
The output of a program that correctly implements the Robot class should behave as follows:
>>> robot_1 = Robot("Robbie")
>>> robot_1.get_name()
Robbie
>>> robot_1.get_phrase()
Hello World!
>>> robot_1.set_phrase("Merhaba Dunya!") # Means "Hello World!" in Turkish. :)
>>> robot_1.get_phrase()
Merhaba Dunya!