Files
30-seconds-of-code/python/snippets/is-divisible.md
2023-05-01 22:43:50 +03:00

399 B

title, type, tags, unlisted, cover, dateModified
title type tags unlisted cover dateModified
Number is divisible snippet
math
true interior-9 2021-01-04T12:47:04+02:00

Checks if the first numeric argument is divisible by the second one.

  • Use the modulo operator (%) to check if the remainder is equal to 0.
def is_divisible(dividend, divisor):
  return dividend % divisor == 0
is_divisible(6, 3) # True