python question 11

(4 pts) Write a Python function named get_loss_dates. This function will read in a file containing information about the daily stock price for a specific company (e.g. APPL.txt would contain the daily stock prices for Apple). This function should return a list of the dates in which the stock price decreased (e.g. closed lower than it opened). It will have a single parameter named filename, the name of the file containing the stock data (e.g. “AAPL.txt”).

The format of the file is given below. Note that the first line will always be a “header” that contains the names of the columns, not actual data.


def get_loss_dates(filename):
“` Returns list of dates when stock closed lower than it opened. “`

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.