Question: Python: 1) create a constructor__init__ method that takes a list of possible answers. It sets this object's answer_list (instance variable) to the passed list of

Python:

1) create a constructor__init__ method that takes a list of possible answers. It sets this object's answer_list (instance variable) to the passed list of possible answers, it sets this object's question_list (instance variable) to the an empty list, and it sets this object's answer_history_list (instance variable) to an empty list.

2) create the __str__ method. It should return a string with all the possible answers in answer_list separated by commas. For example : "Yes, No, Not clear".

3) Create the shake_ball method it randomly picks an index from 0 to the number of items in the answer_list minus one, it adds that index to the end of the answer_history_list, and it returns the answer at the picked index

4) Create the check_question method that takes a question it checks if the question is in the question_list and if so returns "I already answered that question!. Otherwise it adds the question to the question_list and returns the answer from shake_ball

5) Create the print_history method prints "[answer index] question - answer" for each of the indices in the answer_history_list from the first to the last with each on a single line. If there are not items in the answer_history_list it prints "None yet" and it does not return anything!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!