Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Codes below are supposed to filter out elements which are not numbers from a given list A , and calculate only the sum of elements

Codes below are supposed to filter out elements which are not numbers from a given
list A, and calculate only the sum of elements which are numbers. The correct output
of below codes should be 7+4j. At current state, there are errors in the codes. State
what are the errors, what is the output at current erroneous state, and provide the
corrected version of the codes.
from functools import reduce
True, 1.0,3,"Hi",3+4j]
def isNumber (x) :
return type (x)== 'float'
def sumofNumber (x,y) :
return x+y
reduce (sumofNumber, filter (isNumber, A))
image text in transcribed

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain the various techniques of Management Development.

Answered: 1 week ago