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, 24.06.2019 00:20
Describe a data structures that supports the stack push and pop operations and a third operation findmin, which returns the smallest element in the data structure, all in o(1) worst-case time.
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
What did i do wrong with this const discord = require('discord.js'); var bot = new discord.client(); const token = 'ntm3mjcxmtu1mjg3ote2ntq2.dyogew.dpfiwfpuifzuzvifop-csuxasnm' const prefix = "! " bot.registry.registergroup('simple', 'simple'); bot.registry.registerdefaults(); bot.registry. + '/commands'); bot.on('message', message => { if(message.content == 'hi! ') { message.channel.send ('@everyone sup, how is @everyone day going'); } if(message.content == 'h3lp') { message.channel.send ('dose not have any commands yet'); } bot.on('ready', function() { console.log("ready") }); bot.login(token);
Answers: 1
question
Computers and Technology, 24.06.2019 18:00
Which of the following is an example of synchronous communication? a) e-mail b) voicemail c) telephone conversation d) text message.
Answers: 1
question
Computers and Technology, 24.06.2019 23:00
Systolic pressure is a measure of blood pressure when the ventricles relax and fil with blood ture or false
Answers: 1
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
English, 13.10.2020 14:01
question
Health, 13.10.2020 14:01
question
History, 13.10.2020 14:01
question
Mathematics, 13.10.2020 14:01
Questions on the website: 13722362