(3) find_median () #you have to determine the signature Description: Design and write a function called find_median () which determines the median of an ordered list of values. If the list is empty, the median is None. Note that if necessary, the median is half-way between two values. Round to the nearest hundredth, as needed. An empty list has None for a median. Parameters: (read the description carefully) Return value: (read the description carefully) Assumptions: The values in the list are in increasing (ascending) order. Examples: find_median ([1, 3, 5, 16, 1031) 5 find_median ([22, 33, 44, 55, 66, 771) find median ([11.3, 44.44, 47.66, 47.66, find_median ([-53]) -53 49.5 101, 908.21]) → 47.66

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

3A in Python language please:

 

## Find Median Function

### Description:
Design and write a function called `find_median()` which determines the median of an ordered list of values. If the list is empty, the median is `None`. Note that if necessary, the median is halfway between two values. Round to the nearest hundredth, as needed. An empty list has `None` for a median.

### Parameters:
- (Read the description carefully)

### Return Value:
- (Read the description carefully)

### Assumptions:
- The values in the list are in increasing (ascending) order.

### Examples:
- `find_median([1, 3, 5, 16, 103])` ⟶ `5`
- `find_median([22, 33, 44, 55, 66, 77])` ⟶ `49.5`
- `find_median([11.3, 44.44, 47.66, 47.66, 101, 908.211])` ⟶ `47.66`
- `find_median([])` ⟶ `None`
Transcribed Image Text:## Find Median Function ### Description: Design and write a function called `find_median()` which determines the median of an ordered list of values. If the list is empty, the median is `None`. Note that if necessary, the median is halfway between two values. Round to the nearest hundredth, as needed. An empty list has `None` for a median. ### Parameters: - (Read the description carefully) ### Return Value: - (Read the description carefully) ### Assumptions: - The values in the list are in increasing (ascending) order. ### Examples: - `find_median([1, 3, 5, 16, 103])` ⟶ `5` - `find_median([22, 33, 44, 55, 66, 77])` ⟶ `49.5` - `find_median([11.3, 44.44, 47.66, 47.66, 101, 908.211])` ⟶ `47.66` - `find_median([])` ⟶ `None`
**User Defined Functions and Recursion**

**Background**

The purpose of this programming task is to practice writing function definitions, using functions inside other functions, and using recursion to solve complex problems.

**Restrictions**

Avoid any function that violates the following:

- You are not allowed to import anything.
- You are not allowed to use the global keyword, nor should you have any global variables. In other words, do not create any variables outside of a function definition.
- You are not allowed to use slicing (except for the fifth function `add_chars`).
- No built-in function except `round()`, `range()`, and `len()` is allowed.
- From list methods, you are allowed to use `.append()`, `.insert()`, `.remove()`, or `del`.
- From dictionary methods, you are allowed to use `.keys()`, `.values()`, `.items()`.

**Testing**

In addition to the examples in the tester file, you should also devise your own test cases for your code. Develop additional test cases to ensure that you haven't missed anything (such as empty lists, differently sized lists, etc.) and your code is correct. The goal is to keep your focus on writing correct code.

**Functions**

In this programming task, you will be writing and calling a handful of functions (five). From the description, you will generate the signature and function body for each function. (The examples can give you hints about the signatures!)
Transcribed Image Text:**User Defined Functions and Recursion** **Background** The purpose of this programming task is to practice writing function definitions, using functions inside other functions, and using recursion to solve complex problems. **Restrictions** Avoid any function that violates the following: - You are not allowed to import anything. - You are not allowed to use the global keyword, nor should you have any global variables. In other words, do not create any variables outside of a function definition. - You are not allowed to use slicing (except for the fifth function `add_chars`). - No built-in function except `round()`, `range()`, and `len()` is allowed. - From list methods, you are allowed to use `.append()`, `.insert()`, `.remove()`, or `del`. - From dictionary methods, you are allowed to use `.keys()`, `.values()`, `.items()`. **Testing** In addition to the examples in the tester file, you should also devise your own test cases for your code. Develop additional test cases to ensure that you haven't missed anything (such as empty lists, differently sized lists, etc.) and your code is correct. The goal is to keep your focus on writing correct code. **Functions** In this programming task, you will be writing and calling a handful of functions (five). From the description, you will generate the signature and function body for each function. (The examples can give you hints about the signatures!)
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education