P
P
pcdesign2020-05-16 09:25:11
Python
pcdesign, 2020-05-16 09:25:11

How to round up to a certain multiplicity?

Something I can't figure out.
For example, there is a product, it is sold at least 10 meters in multiples.
An order for 1 meter arrives - Should be rounded up to 10 meters.
If 12m to 20m
If 29.5 meters to 30 meters
, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2020-05-16
@pcdesign

import math
quantum = 10
quantum * math.ceil(12 / quantum)  # 20

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question