Files
30-seconds-of-code/snippets/is-divisible.md
Angelos Chalaris f6a215e9e3 Kebab file names
2023-04-27 22:00:06 +03:00

419 B

title, tags, unlisted, cover, firstSeen, lastUpdated
title tags unlisted cover firstSeen lastUpdated
Number is divisible math true interior-9 2019-08-20T14:19:55+03:00 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