<|im_start|>user
How can I create a program that calculates the average score from a list of student grades stored in a file?<|im_end|>
<|im_start|>assistant
```python
def calculate_average(filename):
    total_score = 0
    count = 0
    with open(filename, 'r') as file:
        for line in file:
            try:
                score = float(line.strip())
                total_score += score
                count += 1
            except ValueError:
                print(f"Invalid score found: {line.strip()}")
    if count == 0:
        return "No valid scores found."
    return total_score / count<|im_end|>

<|im_start|>user
How can I create a program that calculates the average score from a list of student grades stored in a file?<|im_end|>
<|im_start|>assistant
```python
def read_scores(filename):
    with open(filename, 'r') as file:
        scores = file.readlines()
    return scores<|im_end|>

How can I create a program that calculates the average score from a list of student grades stored in a file?