Question: Note: An example user-interaction loop is provided at the bottom of this page. That code might help in getting started with this problem The TTS

Note: An example user-interaction loop is provided at the bottom of this page. That code might help in getting started with this problem The TTS software For this problem, you will implement a (text-based) menu of options for analyzing a list of prices for a stock over several days (or any list of floating-point values). This provides an opportunity to use loops in a variety of ways, as well as experience handling user input. The top-level function to write for this problem is required to be called tts() [Using this name will keep the graders happy!] Note that it takes no inputs. Instead, it should offer the user a menu with these choices: (0) Input a new list (1) Print the current list (2) Find the average price (3) Find the standard deviation (4) Find the min and its day (5) Find the max and its day (6) Your TTS investment plan (9) Quit Enter your choice: Feel free to change the wording or text, but please keep the functionality of these choices intact. If youd like to add additional menu options of your own design, please use different values for them (see extra credit, below). Once the menu is presented, the program should wait for the users input. (You may assume that the user will type an integer as input.) The function should then print a warning message if the integer is not a valid menu option quit if the user inputs 9 allow the user to input a new list of stock prices, if the user selects choice 0 print a table of days and prices, with labels, if the user selects choice 1 compute the appropriate statistics about the list for choices 2-6 For any option except 9, the function should reprompt the user with the menu after each choice. Most of the calculations are straightforward, but here are a couple of pointers on two of them: The time-travel strategy: For menu option 6, you will want to find the best day on which to buy and sell the stock in question in order to maximize the profit earned. However, the sell day must be greater than or equal to the buy day. You may want to adapt the example function diff from class (to be covered) in order to find this maximum profit. Calculating the standard deviation: Please use this formula to calculate the standard deviation of the stock. Note that aListave is the average (mean) value of the elements of the list aList. Also, its OK to assume that aList will always be non-empty.stdev.png Inputting a new list Notice in the code below, we allow the user to input a list, e.g., [12, 13, 14.5], by using Pythons eval() function. The eval function takes a string and evaluates it, in this case, makes a list. Helper functions You must write a helper function for each of the menu options except 9 (Quit). For all the helper functions, but not the one for option 0, you are required to have good doctests. What are good test cases? Ones that can convince you and others that the function works correctly! We include an example run that illustrates one possible interface for your tts() function a little further down on this page Extra credit: creative menu options (up to +5 pts extra but max of 35 total pts) If youd like, you may add other menu options (under different numeric labels) that process the list in some other way of your design it can be serious or not. Either way, your options will be graded on what they do and how smoothly they interact with the user. Remember that the CSCI 203 graders get lonely conversational programs are welcome!

Example run of the program Here is an example run you do not need to follow this format exactly (though you may), but its meant to show an example of each menu possibility:

>>> tts()

(0) Input a new list (1) Print the current list (2) Find the average price (3) Find the standard deviation (4) Find the min and its day (5) Find the max and its day (6) Your TTS investment plan (9) Quit

Choose an option: 0 Enter a new list of prices: [20, 30, 10] (0) Input a new list (1) Print the current list (2) Find the average price (3) Find the standard deviation (4) Find the min and its day (5) Find the max and its day (6) Your TTS investment plan (9) Quit Choose an option: 1 Day Price--- ----- 0 20.00 1 30.00 2 10.00

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!