Whole Dollars
Round every price in prices to the nearest whole dollar and return the results as a list of ints. No price will end in exactly .5.
Example 1
prices [2.3,4.8,10.0]
returns [2,5,10]
2.3 rounds to 2, 4.8 rounds to 5.
Constraints
1 <= len(prices) <= 100- No price has a fractional part of exactly 0.5
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Z-ScoresEasy
- Zero PositionsEasy
- Best Columns of Each RowMedium
- Cells Above Row AverageMedium
- Count Local PeaksMedium
- Deepest Fall From a HighMedium
- Distance From a CellMedium
- Halfway PointMedium