Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a lab assignment for my intro to programming class using python. In this lab we are supposed to read in a text file

I have a lab assignment for my intro to programming class using python. In this lab we are supposed to read in a text file with grades.

The text is this:

Homework 10% 40/40, 10/40,30/40, 4/5,18/40,40/40,76/80,10/10 Quizzes 10% 10/10,10/10,8/10,9/10,0/10,10/10,6/10 Tests 35% 89/100, 97/100 Projects 30% 56/60,60/60 Final 15% 495/550

**We are not allowed to edit the above text**

I already have functions that can work compute the averages of the lists, weights, and the final grade. But I cant seem to get this part working correctly. I need to separate the score lists into scores earned and total scores. But I am hitting a wall. Any help is appreciated.

This is my current code:

image text in transcribed

def get_file(fileName): 1 score_dict - th infile - open(fileName , 'r') for line in infile: lines-line.strip() lines-line.split(' ') items'".join(lines [2:]) itemsitems.rstrip() items items. split(' , ? ) score dict [lines [01items return score dict

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

More Books

Students also viewed these Databases questions