Python program that will take two numbers: a and b.Return a number that is a roundup version of a so that it is multiple of b: Examples:
a=13, b = 5, return 15.
a=15, b = 3, return 15
a = 16, b = 3, returns 18'
答案 0 :(得分:0)
A solution using math.ceil
:
import math
def round_up(a,b):
return math.ceil(a/b) * b
print(round_up(13, 3))
print(round_up(16, 3))
Output:
15
18