Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

As you examine the bridges more closely, you'll notice that each one has a sign with some numbers. You assumed these are the number of

As you examine the bridges more closely, you'll notice that each one has a sign with some numbers. You assumed these are the number of people who have safely crossed each bridge. So you want to calculate the average and pick the bridge with the highest number. Again, you want to be wise about it and you will find an average without minimum and maximum value. Very often, it is useful to split a problem into smaller problems and solve them one by one. Question 4.1: Write a function that takes a non-empty list of a number of people who crossed a bridge and calculates the average for the given list according to our definition of the average above. Round the number to the second decimal place and return your answer. If the length of the list is less than or equal to two, then return 0.0 Hints: min(), max() might be useful sum() might be useful Use round() built-in function. Input Output Reason [2,4,10,7,9]6.67 Drop 2(minimum) and 10(maximum). The average is (4+7+9)/3=6.6666... Rounded to the second decimal place is 6.67 def average_without_min_max(people): """>>> average_without_min_max([10,10,1,16])10.0>>> average_without_min_max([2,4,10,7,9])6.67>>> average_without_min_max([2,0,10,5])3.5"""

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

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions

Question

explain what is meant by redundancy

Answered: 1 week ago