subject

Create a function min_mid_max which takes a list as its formal parameter and returns a new list with the following characteristics: element 0 contains the minimum value • element 1 contains the middle value (not the median -- which would require an average if the list had an even number of elements). If the list is even (e. g. [1,2,3,4]) the 'middle' value will be the right value of the two possible choices (e. g. 3 rather than 2). • element 2 contains the maximum value Notes: • You can only use Python syntax shown so far (even if you know more) • You cannot use any math library (we have yet to see this) • You should use the function sorted. Remember the function sorted does not change its input, it returns a new list. • You should only need to call sorted one time. print(sorted(3,2,1])) • You can use the function int (another built in function) to help determine the index of the middle value. This function takes a floating point (or any kind of number) and converts it into an integer (e. g.print(int(4.32)). This will allow you to treat lists with an even number of elements the same as a list with a odd number of elements. • If min_mid_max is called with an empty list, return an empty list. • If min_mid_max is called with 1 item that item is the min, mid, and the max • If min_mid_max is called with 2 items, the mid and the max should be the same • No need to worry about the incoming list being the value None

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
The “rule of 72” is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
In cell h5 enter a formula that will calculate the percentage of attendees that went to the altamonte springs job fair in 2018.
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
Scientists have changed the model of the atom as they have gathered new evidence. one of the atomic models is shown below. what experimental evidence led to the development of this atomic model from the one before it? a few of the positive particles aimed at a gold foil seemed to bounce back. the colors of light emitted from heated atoms had very specific energies. experiments with water vapor showed that elements combine in specific proportions. cathode rays were bent in the same way whenever a magnet was brought near them.
Answers: 2
You know the right answer?
Create a function min_mid_max which takes a list as its formal parameter and returns a new list with...
Questions
question
Mathematics, 20.10.2020 02:01
question
Mathematics, 20.10.2020 02:01
question
Mathematics, 20.10.2020 02:01
question
History, 20.10.2020 02:01
question
Mathematics, 20.10.2020 02:01
question
Chemistry, 20.10.2020 02:01
Questions on the website: 13722364