Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1 Create three functions that each accept three parameters. The first function should be named sum_function and should return the sum of all numbers

Part 1

Create three functions that each accept three parameters.

The first function should be named sum_function and should return the sum of all numbers (add them all together)

The second function should be named product_function and should return the product of all numbers (multiply them all together)

The third function should be named average_function and should return the average of all numbers

HINT: The average is the sum divided by the number of items.

Print out the result of calling each function. For example:

print(sum_function(1, 2, 3)) 

Should print: 6

Part 2

Create three lambda functions that do the same thing as the functions in step 1. Assign each lambda function the following vairables:

add_numbers

multiply_numbers

average_numbers

Print and call the above functions

Part 3

Creating three separate lists named the following: list_one, list_two, list_three

Add the following numbers in to their respective lists:

numbers 4, 6, 88, and 24 should go within list_one

numbers 17, 34, 9, and 5 should go within list_two

numbers 63, 20, 98, and 4 should go within list_three

Create one lambda function named average_maker that takes in three numbers and finds the average.

Use map to compute the average of each set of values at each index. This will produce a new list of the four average calculations.

The variable name for this calculation should be map_results

You will be using each of the lists within the map function.

Print out the end result of using map.

Hint! You will need to use list()

The final output should be as shown below:

[28.0, 20.0, 65.0, 11.0]

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

Influences on Nonverbal Communication?

Answered: 1 week ago