Challenge: Marks Report
Completed
Read a list of marks on one line and print a report.
Input
One line of whole numbers separated by spaces.
Output
Total: <sum> Highest: <max> Lowest: <min> Average: <average with 2 decimals>
Example
Input
78 92 65 88
Output
Total: 323 Highest: 92 Lowest: 65 Average: 80.75
Editor
Python
Hints
[int(x) for x in input().split()] gives a list of numbers.
f"{value:.2f}" shows 2 decimals.
Solution explanation
sum, max, min and len do all the work. The :.2f format always shows two decimal places.
Show solution
marks = [int(x) for x in input().split()]
print("Total:", sum(marks))
print("Highest:", max(marks))
print("Lowest:", min(marks))
print(f"Average: {sum(marks) / len(marks):.2f}")