Question: Python help. Not sure how to do. Can get it to return values for stocks, but not for non-case sensitive stocks. Also, won't return None

 Python help. Not sure how to do. Can get it to

return values for stocks, but not for non-case sensitive stocks. Also, won't

Python help. Not sure how to do. Can get it to return values for stocks, but not for non-case sensitive stocks. Also, won't return "None" for stocks entered that aren't in list (for example made up FGH stock).

Part 1 You are very interested in buying some new stocks to add to your portfolio. Below is a list of four company's stocks with the following information: ticker (see link for explanation), price per share, industry, trend (whether the stock's price has been increasing or decreasing), and reversal (whether or not the stock's trend is predicted to reverse in the near future). Ticker Price per Share Industry Current Trend Reversal AMD XOM TSLA 23.98 79.62 322.82 11.63 Up" Down Up Down True False False True Energy Technology Eunction name: can_buy Parameters: str, float, int Returns: boolean or NoneType Description: Write a function that takes in a stock's ticker as a string, a wallet amount as a float, and number of shares as an int. Given this information, calculate whether or not you can afford to buy that number of shares of the particular stock given the amount in your wallet. If you can afford to buy that number of shares that stock, return True; if you cannot, return False. If a ticker that is not present in the table is passed through, return None. Assume the number of shares and wallet amount are nonnegative values. Case sensitivity should not matter: "A" shoulkd be treated as "a >>> test-one-can buy("XOM", 1503.23, 7) >> print(test one) True >>> test two can buyf amd", 150, 120) >>> printtest two) False

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!