Solution for the given question are as follows -
Code :
def function20(li):
# Sort list in ascending order
li.sort()
#Find the median.
length = len(li)
if (length % 2 == 0):
median = (li[(length)//2] + li[(length)//2-1]) / 2
else:
median = li[(length-1)//2]
return median
# list
li = [1, 2, 3, 4]
# call to function20
median = function20(li)
# print the result
print("Median = ", median)
Code Screen Shot :

Output :
![Median = 2.5 ... Program finished with exit code o Press ENTER to exit console.]](http://img.homeworklib.com/questions/705326e0-6cfc-11eb-8806-fd396844f96a.png?x-oss-process=image/resize,w_560)
basic python coding Function name: function 20 Function parameters: a list of numbers Function behavior: find...
PYTHON: Function name: function13 Function parameters: none Function behavior: Hard code the following data structure in the function. data = {('Dogs', 1): ['Poodle', 'Lab','Shitzu'], ('Cake', 2): ['Sugar', 'Flour', 'Eggs'], ('Taco', 1): ['Beef', 'Steak', 'Chicken'], ('Colors', 1): ['Green','Yellow']} We have a dictionary where the keys are tuples with a subject and the values are correlated in that subject. Retrieve the names "steak" and "chicken" from the Taco key. Function return: A list with the second two taco options (Steak and Chicken)
python
Days of the Week Function Name: days_of_the_week() Parameters: list of birthdays ( list ), year (int ) Returns: list of names ( list ) Description: You and your friends all want to celebrate your birthdays together, but you don't want to stay up late on a school night. Write a function that takes in a list of tuples formatted as (day ( int ), month ( int ), name (string)), and a year ( int ). Use Python's calendar...
Python Write a function that takes in two numbers as parameters. The function will then return the value of the first parameters squared by the second parameter. Print the value of the return statement. Take a screenshot of both your code and your properly executed code after you have run it. Submit the screenshots here along with your .txt file.
Language: Python Function name : findwaldo Parameters : string Returns: int Description: Write a recursive function that takes in a string containing some combination of letters, numbers, and spaces, and return the starting index of the first instance of “waldo” contained in that string. If the string does not contain “waldo”, return -1. This function IS case sensitive, so “waldo” is not the same as “WALDO”. Code using string functions such as .index() and .find() that oversimplify the problem will...
Write a Python function called FiveNumberSummary(myList) that takes as input a sorted list of numbers and calculates and displays a five-number summary of the list. Given a list of numbers, a five-number summary of the numbers is defined to be the following: Minimum, First Quartile, Median, Third Quartile, Maximum. The first and third quartiles are simply the median of the first half of the numbers and the median of the second half of the numbers.
Find the critical numbers of the function anddescribe the behavior of f at these numbers. (List youranswers in increasing order.) f(x) =x10(x -1)9 At the function has ( local min orlocal max or neither ) At the function has ( local min orlocal max or neither ) At the function has ( local min orlocal max or neither )
Language: Python Topic: APIs and JSON Function name: can_visit Parameters: country_code (str), langList (list of strings ) Return: boolean Description: You are looking for a country to visit for SB2K19 and want to ensure that you know how to speak at least one of the languages spoken in that country. Given a country_code (str), a three - letter code representing the country you want to visit, and a langList (list), a list of the names of the languages you know...
1. use python List to Dictionary Write a function that has three parameters: a list of unsorted numbers with no duplicates, a start number, and an end number. This function should return a dictionary with all integers between the start and end number (inclusive) as the keys and their respective indices in the list as the value. If the integer is not in the list, the corresponding value would be None. Example unsorted list: [2,1,10,0,4,3] two numbers: 3, 10 returned...
in Python, define a function named filterOut with three parameters. The first argument passed to the function should be a list of dictionaries (the data), the second a string (a dictionary key), and the third another string (a dictionary value). This function must return a list of all the dictionaries from the input list which do NOT contain the indicated key:value pairing. in Python, define a function named filterInRange with four parameters. The first argument passed to the function should...
Python Function Name: networks Parameters: int, list of tuples of int Returns: list of sets of int Description: In your class, many students are friends. Let’s assume that two students sharing a friend must be friends themselves; in other words, if students 0 and 1 are friends and students 1 and 2 are friends, then students 0 and 2 must be friends. Using this rule, we can partition the students into circles of friends. To do this, implement a function...