Question
3. Write a function, calcPerc(lst) which takes the elements of a list, calculates their total (excluding non-numerics), and creates a new list with their percentages
3. Write a function, calcPerc(lst) which takes the elements of a list, calculates their total (excluding non-numerics), and creates a new list with their percentages as shown below. If the percentage is less than 50%, an * is placed next to it in the list. If the list is empty, an * is placed in the first position in the list. A separate list is kept of each non-numeric. You must use a try/except to check for non-numerics, raise the less than .5 exception and raise the empty list exception. This program returns a list with the first element being the list of non-numerics, and the second element being the percentages. See below for sample output.
This is what the output should look like and in python please
>>calcPerc(C1,2,3,0]) * I >>>calcPerc([] >calcPerc(C'a','b', c']
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started