Login and get codingWrite a function that accepts a number and a multiple, then rounds the number towards the next multiple.

Examples:

NumberMultipleOutput0 5 0 2 5 5 5 5 5 42 5 45 -6 -10 -10 -6 -10 -10 ---

Imagine this on a number line.

* Number:

0Multiple:5

-3 -2 -1 0 1 2 3 4 5 0 0

Since zero is a multiple of five the answer is

0.---

* Number:

2Multiple:5

-5 -4 -3 -2 -1 0 1 2 3 4 5 2 => 5

The next multiple of five from two is

5.---

* Number:

-6Multiple:-10

-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 -6 -10 <=

The next multiple of negative 10 from negative six is

-10.

Metrics »

143 out of 145 users completed this Bite.

Will you be Pythonista #144 to crack this Bite?

Resolution time: ~32 min. (avg. submissions of 5-240 min.)

Pythonistas rate this Bite 3.2 on a 1-10 difficulty scale.

» You can do it! 😌