Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

image text in transcribed

ATTEMPTED: (it reads but im having trouble printing the lone 'k' from the file

image text in transcribed

image text in transcribed

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 ijj

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

Step: 3

blur-text-image

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions