PYTHON CS1 PROBLEM Define a function that takes a dictionary gdict as a parameter and returns a list of values that are associated with only a single key in the dictionary. For example: 1. If gdict = ("a":3, "b": 4, "X": 3, "2": 5, "K": 4, "C": 1) then your function should return the list [1, 5]. 3 and 4 are not in the returned list because they are associated with more than one key. 2. If gdict = ("a":3,"b": 4, "X": 3, "K: 4) then your function should return the list [].

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question

Python code 

Screenshot and output is must

PYTHON CS1 PROBLEM
Define a function that takes a dictionary gdict as a parameter and returns a list of values that are
associated with only a single key in the dictionary.
For example:
1. If gdict = ("a":3, "b": 4, "x": 3, "z": 5, "k": 4, "c": 1) then your function should
return the list [1, 5]. 3 and 4 are not in the returned list because they are
associated with more than one key.
2. If gdict = ("a":3,"b": 4, "X": 3, "k": 4) then your function should return the list [].
3. If gdict = () then your function should return the list [].
Transcribed Image Text:PYTHON CS1 PROBLEM Define a function that takes a dictionary gdict as a parameter and returns a list of values that are associated with only a single key in the dictionary. For example: 1. If gdict = ("a":3, "b": 4, "x": 3, "z": 5, "k": 4, "c": 1) then your function should return the list [1, 5]. 3 and 4 are not in the returned list because they are associated with more than one key. 2. If gdict = ("a":3,"b": 4, "X": 3, "k": 4) then your function should return the list []. 3. If gdict = () then your function should return the list [].
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning