I'm given a text document with marks and course codes, and I need to create a function where you input the directory of the file, and the course code. Doing so, the code will return the average mark of all the marks in the text with that course code. Any ideas?

Recommended Answers

All 2 Replies

It's similar to those posts, but for me I have to write a function like this
def avg(file,code):
The user has to input the directory of the file, and the course code. The code that I have to write will return the average of all the marks with that course code in the file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.