Back to Freecodecamp

Challenge 218: Evenly Divisible

curriculum/challenges/english/blocks/daily-coding-challenges-python/699c8e045ee7cb94ed2322d9.md

latest1.4 KB
Original Source

--description--

Given two integers, determine if you can evenly divide the first one by the second one.

--hints--

is_evenly_divisible(4, 2) should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_evenly_divisible(4, 2), True)`)
}})

is_evenly_divisible(7, 3) should return False.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_evenly_divisible(7, 3), False)`)
}})

is_evenly_divisible(5, 10) should return False.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_evenly_divisible(5, 10), False)`)
}})

is_evenly_divisible(48, 6) should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_evenly_divisible(48, 6), True)`)
}})

is_evenly_divisible(3186, 9) should return True.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_evenly_divisible(3186, 9), True)`)
}})

is_evenly_divisible(4192, 11) should return False.

js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_evenly_divisible(4192, 11), False)`)
}})

--seed--

--seed-contents--

py
def is_evenly_divisible(a, b):

    return a

--solutions--

py
def is_evenly_divisible(a, b):
    return a % b == 0