Question: The algorithms team often needs to extract stock prices from financial data. The take - home coding challenge asks you to write a function extract

The algorithms team often needs to extract stock prices from financial data. The take-home coding challenge asks you to write a function extract_stock_price() that takes a string representing a stock data record and returns the stocks price as an integer. If a price is not found in the string, return 0. The price will always be given as an integer. If a float appears in the string you can ignore it and return 0. The stock data record contains the stock symbol, its price, and other data, with each field being separated by a colon.
>>> price = extract_stock_price('APPL;Trading above cap;180;SELL;do not short')
>>> price
180

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!