Temporary Styling With a Context Manager
One figure in an otherwise plain Marlow & Finch report needs a different background from the rest, and nobody wants to change the house look by hand only to forget to change it back. The trick is to wrap just that chart in a block that applies the style inside it and restores the old one on the way out. The chart shows a value per category; the caption under it is the total.
Task: Print the total of all the values.
Input
The first line holds one integer n, the number of records, where 1 <= n <= 1000. Then come n lines, each holding a category name and a value separated by a single space. Category names contain no spaces, and values may be negative.
Output
One line holding the total of every value in the input, rounded to 2 decimal places. Every record counts, whatever category it belongs to.
Example:
Input:
3
A 10
B 20
C 30
Output:
60.00
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in