Time to combine a list, a loop, an if, a function, and f-strings into one small program — exactly the kind of integration real programs are made of.
You're given a list of test scores. Build a tiny score report.
Your tasks
Given this starting value:
scores = [88, 72, 95, 60, 79]
1. Write a function average(nums) that returns the average of a list of numbers (use sum() and len())
2. Use a loop to count how many scores are 80 or higher, storing the count in passed
3. Call your function on scores and store the result in avg
4. Print two lines with f-strings: the average to one decimal place, and how many passed out of the total
Expected output
Average: 78.8
Passed: 2 of 5
Constraints
- Define and use the
average() function — do not hard-code the average
- Use a
for loop and an if to count passers — do not hard-code passed
- Use f-strings for both printed lines
- Format the average with one decimal place using
{avg:.1f}