Percent of Total
sales holds how much each store sold (never negative, and the total is above 0). Return an array giving each store's share of the overall total as a percentage, so the results add up to 100.
Example 1
sales [1,3]
returns [25.0,75.0]
The total is 4, so the shares are 25.0 and 75.0.
Constraints
1 <= len(sales) <= 100- All values are 0 or more, and at least one is above 0
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Pick ItemsBeginner
- Price With TaxBeginner
- Range of ReadingsBeginner
- Recent AverageBeginner
- Running TotalBeginner
- Same PositionsBeginner
- Shopping TotalBeginner
- Side by Side ColumnsBeginner