Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON PROBLEM: txt file to print ATTEMPTED: (it reads but im having trouble printing the lone 'k' from the file We will store this graph
PYTHON PROBLEM: txt file to print
ATTEMPTED: (it reads but im having trouble printing the lone 'k' from the file
We will store this graph in a dictionary: each person'sode's name will be a key (str) whose associated value is a set of str of the peopleode names of his her friends. Read a file where each line is either one node name (a person with no identifiable friends) or a pair of node names (representing an undirected friendship edge) in the graph. Note that node names may be any number of characters (not just the single characters used in this example), separated by one semicolon character. Build a dictionary whose keys are str node names, and whose associated values are sets of str node names that are friends. We annotate this dictionary as sstr:sstri). For example, the input file graphl.txt contains the following lines (which could appear in this order, or any other order, and still produce the same dictionary). By convention, we will put all friendless names at the end of the file. ajb ajc bjc cid dje dif Cjg 311 g3j ijjStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started