Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1 . get _ keys ( ) Write a function definition with the following expectations: The function name is get _ keys and has

Part 1. get_keys()
Write a function definition with the following expectations:
The function name is get_keys and has a dict[str, int] parameter.
The function should return a list[str]
The function should produce a list of all the keys in the input dictionary.
If the input dict is empty, it should return an empty list.
The function should not mutate (modify) the input dictionary.
Explicitly type variables, parameters, and return types.
Example usage:
from lessons.unzip import get_keys
> test: dict[str, int]={"Hello" : 1, "World" : 2}
get_keys(test)
['Hello', 'World']
Part 2. get_values()
Write a function definition with the following expectations:
The function name is get_values and has a dict[str, int] parameter.
The function should return a list [int]
The function should produce a list of all the values in the input dictionary.
If the input dict is empty, it should return an empty list.
The function should not mutate (modify) the input dictionary.
Explicitly type variables, parameters, and return types.
Example usage:
> from lessons.unzip import get_values
test: , int]={"Hello" : 1, "World" : 2}
>> get_values(test)
1,2
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

Compute the length of the polar curve. r = 1 + for 0 /2

Answered: 1 week ago