#136EasyOperators· Integer Arithmetic
Split the Bill
Input format
`total_cents`: the bill in cents. `people`: how many people share it. `tip_percent`: a whole-number percentage.
Output format
A list of `people` strings, each with exactly two digits after the dot.
Examples
Input: total_cents = 10000, people = 3, tip_percent = 15
Output: ["38.34","38.33","38.33"]
The tip is 1500, so 11500 cents are split three ways: 3833 each with 1 cent left over for the first person.
Input: total_cents = 999, people = 1, tip_percent = 0
Output: ["9.99"]
One person pays everything.
Constraints
- 0 <= total_cents <= 10^7
- 1 <= people <= 50
- 0 <= tip_percent <= 100
Study first
- #python
- #operators
- #integer-arithmetic
- #money