Find the Next Number Divisible by y
Write a function next_divisible that takes two integers, x and y, as arguments. The function should check if x is divisible by y. If it is, return x. If not, return the next higher natural number that is divisible by y. Hint: remember the modulo operator
%
? You could use it to check if a number is divisible by y.def next_divisible(x, y):
# complete function here...
print(next_divisible(1, 23)) # expected output: 23
print(next_divisible(7, 3)) # expected output: 9
print(next_divisible(15, 7)) # expected output: 21
print(next_divisible(77, 76)) # expected output: 152
Python
Setting up Python environment...
Output