Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions