We want to make a program that, when given a list, will sort through all the values
Question:
We want to make a program that, when given a list, will sort through all the values of the list and take only the numerical values until it encounters the word "done". Then it will return the total sum of these values, the average value, and a count of the number of numerical values in the list. Each list will be string list, so it can contain values such as "Microsoft" or "hello", and every list will contain the word "done" to indicate when your program should stop running.
For example, if we had the list ['hello', '5', 'world', 5, 'done', '12'], it would return an output such as "Total is: 10.0. Average is: 5.0. Count is: 2." since there are only two numbers that it encounters before it reaches the word "done". Note that the number 12 is skipped because the program finds the word 'done' before it reaches 12.
Financial Accounting and Reporting a Global Perspective
ISBN: 978-1408076866
4th edition
Authors: Michel Lebas, Herve Stolowy, Yuan Ding