Write a Python program to compute the largest absolute change that occurred in the price of a stock during a 10 -day per
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Write a Python program to compute the largest absolute change that occurred in the price of a stock during a 10 -day per
The function print _ change should take the prices on the two days and the number of the initial day of the change and print out the message. The function find_change should take no parameters, prompt the user for the stock prices and return a list with the prices on the two days, and the number of the initial day of the change. Other thank the user prompts, find_change should not print anything out. Your main function should use the functions find_change and print_change to execute the program. You must design your program in such a way that you do not have to save all the prices in memory before computing the answer. As well, modifying the total number of days from 10 to 30 (for example) should merely require updating one variable. You are not allowed to use any list, tuple, string variables in this problem other than the return value of find_change, which is a list. You are also not allowed to use 10 variables to store the prices. You will get no credit for such a solution.