Question: Program Requirements ( 1 2 Marks ) The requirements of the system are given below. Please ensure that your functions have the EXACT naming as

Program Requirements (12 Marks)
The requirements of the system are given below. Please ensure that your functions have the EXACT naming as specified! Failure to do so will result in lost marks. You can choose to copy and paste the function names into the implementation cell to avoid spelling mistakes.
Note: you must include a try and except statement in at least two functions in your code.
Define a function selection_sort(nums):
nums: A list of floats.
Return: A sorted copy of the list nums using the selection sort algorithm.
Note: Make sure that you sort a copy of the list. DO NOT modify the original list. You can create a copy of nums by writing the code new_arr = nums.copy(). In addition, marks will not be given if the selection sort algorithm is not used. Pseudocode of the selection sort sorting algorithm is provided above in the Background section.
Define a function extract_temps(temps):
temps: A list of strings representing a set of daily temperatures.
Return: A list of numeric items that represent, where applicable, each element in temps converted to a float
Note: Some of the items in temps cannot be represented as a float. These items should be ignored. Refer to the background section as an example
Define a function calculate_median(nums):
nums: A list of sorted floating numbers.
Return: A float representing the median of nums.
Hint: If the length of a sorted list is odd then the median exists at index n//2 where n is the length of the list and // represents integer division. If the length of a sorted list is even, the median is calculated by the average of the two most middle elements. One of these elements exists at index n//2, can you figure out the other one? For example, the median of [1.0,2.0,3.0,4.0] is (3.0+2.0)/2=2.5
Define a function main(temp_data):
temp_data: A list of strings representing a set of daily temperatures.
Return: A float representing the median of nums. Return the string "N/A" if an error occurs.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!