OBJECTIVE: Write a program in Python that prints the middle value of a dictionary's values, using test_dict from the test_data.py module. NOTE: test_dict is created & imported from the module test_data.py into main.py Example 1: test_dict = ('a':1, 'b':9,'c':2,'d':5} prints 5 Example 2: test_dict = ('b':9,'d':5) prints 5
OBJECTIVE: Write a program in Python that prints the middle value of a dictionary's values, using test_dict from the test_data.py module. NOTE: test_dict is created & imported from the module test_data.py into main.py Example 1: test_dict = ('a':1, 'b':9,'c':2,'d':5} prints 5 Example 2: test_dict = ('b':9,'d':5) prints 5
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![**Objective:**
Write a program in Python that prints the middle value of a dictionary's values, using `test_dict` from the `test_data.py` module.
**Note:** `test_dict` is created & imported from the module `test_data.py` into `main.py`.
**Example 1:**
```python
test_dict = {'a':1, 'b':9, 'c':2, 'd':5} # prints 5
```
**Example 2:**
```python
test_dict = {'b':9, 'd':5} # prints 5
```
**Hint:** You may (or may not) find the following function useful: `list.sort()` which sorts the elements in a list.
Note: The result is automatically stored in the original list, and the return value from the function is None.
Example:
```python
list = [1, 2, 3, 2, 1]
# After calling:
list.sort()
# list = [1, 1, 2, 2, 3]
```
---
**Lab Activity:**
**13.11.1: Middlest Value (Structured Types)**
*File is marked as read-only*
_Current file: `test_data.py`_
```python
# This module creates the test_dict to be used in main.py
# Reads input values from the user & places them into test_dict
dict_size = int(input()) # Stores the desired size of test_dict
test_dict = {}
for _ in range(dict_size): # Loop/Accumulate all of the input values & place into test_dict
(key, value) = input().split(':')
test_dict[key] = value
```
**Graph/Diagram Explanation:**
There are no graphs or diagrams in the provided text. The content focuses on explaining code and logic for programming tasks.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fda2f71b3-a7c2-4eb2-96be-7cc85f59a6b6%2Fd737de4d-2e99-4779-87f9-a58ac5107b16%2F36mft_processed.jpeg&w=3840&q=75)
Transcribed Image Text:**Objective:**
Write a program in Python that prints the middle value of a dictionary's values, using `test_dict` from the `test_data.py` module.
**Note:** `test_dict` is created & imported from the module `test_data.py` into `main.py`.
**Example 1:**
```python
test_dict = {'a':1, 'b':9, 'c':2, 'd':5} # prints 5
```
**Example 2:**
```python
test_dict = {'b':9, 'd':5} # prints 5
```
**Hint:** You may (or may not) find the following function useful: `list.sort()` which sorts the elements in a list.
Note: The result is automatically stored in the original list, and the return value from the function is None.
Example:
```python
list = [1, 2, 3, 2, 1]
# After calling:
list.sort()
# list = [1, 1, 2, 2, 3]
```
---
**Lab Activity:**
**13.11.1: Middlest Value (Structured Types)**
*File is marked as read-only*
_Current file: `test_data.py`_
```python
# This module creates the test_dict to be used in main.py
# Reads input values from the user & places them into test_dict
dict_size = int(input()) # Stores the desired size of test_dict
test_dict = {}
for _ in range(dict_size): # Loop/Accumulate all of the input values & place into test_dict
(key, value) = input().split(':')
test_dict[key] = value
```
**Graph/Diagram Explanation:**
There are no graphs or diagrams in the provided text. The content focuses on explaining code and logic for programming tasks.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY