Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function thirdLst() that takes a two-dimensional list (e.g. list of lists) as a parameter and returns a new list that consists of the

Write a function thirdLst() that takes a two-dimensional list (e.g. list of lists) as a parameter and returns a new list that consists of the averages of the numeric values in each sublist. For example, if the list passed as a parameter has three sublists, then the list returned by the function will have three numeric values in it, representing the average of the numbers in each sublist.

If a sublist does not have any numeric values in it (e.g. it is empty or it only contains types other than float or int), then the function will place a 0.0 in the corresponding spot in the returned list. Recall that the type() function can tell you what type of value is stored in a variable. If the list passed as a parameter is empty the function should return the empty list. The list passed as a parameter should not be modified by the function. Numeric values inside of other collections (e.g. tuples, sets, dictionaries, etc.) should be ignored.

This is the output and in python please

image text in transcribed

Python 3.6.4 Shell Eile Edit Shell Debug Options Window Help >>> st 1 = [ [ 1, 3 . 14j, [ 1 cat, i do g. 1 chicken! ] >>> 1st [ (1, 2) i testi 8] ] 12.07000000000003, 0.0, 8.0] >>>lst 1 01, 3.14], 'cat, 'dog, 'chicken'], [(1, 2), 'test, 8]] >>>lst -makekvgLst (1], [2], [3], ['test, 'cat', 4], [11) >>>lst [1.0, 2.0, 3.0, 4.0, 0.0] >>> 1st Cl Ln: 37 Col: 4

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Organizing Your Speech Points

Answered: 1 week ago