Question: Implement the function magic _ math ( ) using the functions map ( ) , filter ( ) , and reduce ( ) . magic
Implement the function magicmath using the functions map filter and reduce
magichash receives a list of integers, and returns an integer of the following algorithm:
Map each value. If the value n is odd, replace it with n
Map each value. If the value n is even, replace it with n
Filter each value, keeping only values not divisible by
Reduce the list:
a Start with zero
Hint: You have to add an element as the first element of the filtered list
b Add the number if it is odd
c Add half the number if it is even.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
