Question: run ( self ) : This method takes in no parameters ( aside from self ) , and runs the Decision, allowing the user to
runself: This method takes in no parameters aside from self and runs the Decision, allowing the user to choose amongst the available options. In particular, it should do the following:
Verify that self.options is not an empty list. If self.options is empty, then just immediately return the string No options available'.
Print out the prompt for this Decision object, with a newline before and after to make it easily distinguishable from the options.
Print out the available options. Each option should be preceded by the index of that option within the list so if there were options then each option would be preceded by a number between and See the example below.
Ask the user to input a number between and the highest valid index. You may assume that the user will input a valid number.
Get the element at that index from the self.results list.
If the element at that index is a string, return the string.
If the element is a Decision object, call the run method on that Decision object and return the resulting string.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
