Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Want to read this txt file according to the function format. I want to read the txt file into a dictionary using the function below.

Want to read this txt file according to the function format.

I want to read the txt file into a dictionary using the function below.

I think using defaultdict

I beleive it would be like:

{{PHYS-1: {(Alice, A), (John, B)}, BIO-100: {(John, A), (Carol, B), (David, C)}}

sem1.txt

PHYS-1:Alice,A:John,B BIO-100:John,A:Carol,B:David,C

students.py

from collections import defaultdict

def read_db(file : open) -> {str:{(str,str)}}

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

Students also viewed these Databases questions