All problems

Labeling Pie Slices With Custom Text

mediumPythonMatplotlibAnnotations

Harbourline Retail splits last month's returns by reason and shows them as a pie. Slice sizes alone start arguments — people disagree about which of two similar wedges is bigger — so each reason is also written out as a share of all returns. The same strings go into the report's text summary, which is what is graded here.

Task: Print each reason's share of the total, as it appears on its slice.

Input

The first line holds one integer n, the number of reasons. Each of the next n lines holds a reason name and its count, separated by a single space. Names contain no spaces.

Output

One line holding the shares separated by single spaces, in input order. Each share is a share of the sum of all counts, written with exactly one decimal place and a trailing % sign, for example 75.0%. The reason names themselves are not printed.

Example:

Input:
2
A 75
B 25

Output:
75.0% 25.0%

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

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…