Average of Any Number of Marks
Python
15 pts
Average of Any Number of Marks
Define average(*numbers) that accepts any number of numbers and returns their average. If no numbers are given, return 0.
Print average(70, 80, 90). Expected output:
80.0
The checker will also try average(5), average() and a list unpacked with *.
Checklist
- Define
averageso that it accepts any number of numbers. - Return the average of the numbers it receives.
- Return
0when no numbers are given. - Print
average(70, 80, 90).
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
