i have minutes i want to round it like 24 minutes will rounded as 0 and 25 minutes…
Jump to turn (6)
- User
i have minutes i want to round it like 24 minutes will rounded as 0 and 25 minutes rounded as 30 and 30-54 minutes rounded as 30 and 55-60 minutes rounded as 60
- Assistant
You want to round minutes according to these rules:
- 0 to 24 minutes → 0
- 25 to 29 minutes → 30
- 30 to 54 minutes → 30
- 55 to 60 minutes → 60
Note that 25-29 and 30-54 are both rounded to 30, so effectively from 25 to 54 rounds to 30.
Here's a concise way to implement this logic:
Python Example
python