in python write a function where it makes a dictionary from given text file. If no value is present then it is an empty set. should work for any textfile. data with no spaces are keys, data after the tab space is the value def new_dict (textfile): return {} textfile input node1 node2 expected output {'node1': {'node2'}, 'node2': set()}     should work with this text file as well: A B C B A C C A B D E E D F G G F H H G I I H G J J I K L L K M M L

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

in python write a function where it makes a dictionary from given text file. If no value is present then it is an empty set. should work for any textfile. data with no spaces are keys, data after the tab space is the value

def new_dict (textfile):

return {}

textfile input

node1 node2

expected output

{'node1': {'node2'}, 'node2': set()}

 

 

should work with this text file as well:

A B C B A C C A B D E E D F G G F H H G I I H G J J I K L L K M M L 

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Lists
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