This function should test if the `factor` is a factor of `base`.

Return `true` if it is a factor or `false` if it is not.

## About factors
Factors are numbers you can multiply together to get another number.

2 and 3 are factors of 6 because: `2 * 3 = 6`

- You can find a factor by dividing numbers. If the remainder is 0 then the number is a factor.
- You can use the mod operator (`%`) in most languages to check for a remainder

For example 2 is not a factor of 7 because: `7 % 2 = 1`

Note: `base` is a non-negative number, `factor` is a positive number.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def check_for_factor(base, factor):
	

Solutions:
def check_for_factor(base, factor):
	return base % factor == 0


def check_for_factor(b, f):
	return not b % f


def check_for_factor(base, factor):
	return not base % factor


def check_for_factor(base, factor):
	return True if base % factor == 0 else False


check_for_factor = lambda base, factor: base % factor == 0


check_for_factor = lambda a, b: not a % b


check_for_factor = lambda _, __: not _ % __


def check_for_factor(base, factor):
	ans = False
	for x in range(base + 1):
		if factor * x == base:
			ans = True
	return ans


def check_for_factor(n, factor):
	return factor != 0 and n % factor == 0


def check_for_factor(base, factor):
	integer = int(base / factor)
	return base / factor == integer


def check_for_factor(base, factor):
	f = [i for i in range(1, base + 1) if base / i == base // i]
	return True if factor in f else False


def check_for_factor(base, factor):
	return factor in [i for i in range(1, base + 1) if base % i == 0]


check_for_factor = lambda b, f: (b / f).is_integer()


def check_for_factor(b, f):
	return 1 if b % f is 0 else 0


def check_for_factor(base, factor):
	if base % factor == int():
		return True
	else:
		return False


import unittest

def check_for_factor(base, factor):
	return base % factor == 0

class TestCheckForFactor(unittest.TestCase):

	def test_check_for_factor_should_return_true_when_factor_is_divided_by_base(self):
		(base, factor) = (10, 2)
		actual = check_for_factor(base, factor)
		self.assertEqual(actual, True)

	def test_check_for_factor_should_return_false_when_factor_is_not_divided_by_base(self):
		(base, factor) = (9, 2)
		actual = check_for_factor(base, factor)
		self.assertEqual(actual, False)


def check_for_factor(base, factor):
	print(base, factor)
	if base > factor:
		return base % factor == 0
	else:
		return factor % base == 0


import math

def check_for_factor(base, factor):
	return base % factor == 0


def check_for_factor(base, factor):
	ba = base / factor
	return ba.is_integer()


def check_for_factor(base, factor):
	return divmod(base, factor)[1] == 0


def check_for_factor(base, factor):
	return True if (base / factor).is_integer() else False


check_for_factor = lambda b, f: b % f == 0


check_for_factor = lambda base, factor: not base % factor


def check_for_factor(base, factor):
	check = False
	base = int(base)
	factor = int(factor)
	if factor > 0:
		if base % factor == 0:
			check = True
		else:
			check = False
	else:
		check = False
	return check


def check_for_factor(base, factor):
	if base % factor == 0:
		return True
	else:
		return False
s = check_for_factor(10, 2)
print(s)


def check_for_factor(base, factor):
	if base < 0 or factor < 0:
		return False
	elif base % factor != 0:
		return False
	else:
		return True


check_for_factor = lambda a, b: a % b == 0


def check_for_factor(base, factor):
	a = base / factor
	if a - int(a) == 0:
		return True
	else:
		return False


def check_for_factor(base, factor):
	return [False, True][base % factor == 0]


def check_for_factor(base, factor):
	return base % factor == 0
print(check_for_factor(10, 2))


def check_for_factor(base, factor):
	return base % factor == 0 if base != 0 or factor != 0 else False


def check_for_factor(base, factor):
	return base % factor == 0 if factor != 0 and base != 0 else False


def check_for_factor(base, factor):
	for n in range(1, base):
		if base % (factor * n) == 0:
			return True
		else:
			return False


def check_for_factor(base, factor):
	if base % factor == 0 and base > 0:
		return True
	elif base is None:
		return False
	else:
		return False


def check_for_factor(base, factor):
	if base and factor < 0:
		return None
	else:
		a = base % factor
		if a == 0:
			return True
		else:
			return False


def check_for_factor(base, factor):
	return bool(1) if base % factor == 0 else bool(0)


def check_for_factor(base, factor):
	if base % factor != 0:
		return False
	elif base % factor == 0:
		return True


def check_for_factor(base, factor):
	i = base % factor
	if i != 0:
		return False
	return True


def check_for_factor(base, factor):
	return base % factor == 0 and 0 not in [factor, base]


def check_for_factor(base, factor):
	if base % factor == 0:
		print(str(factor) + ' is a factor of ' + str(base))
		return True
	else:
		print(str(factor) + ' is not a factor of ' + str(base))
		return False


def check_for_factor(a, b):
	return not a % b


def check_for_factor(g, f):
	a = g % f
	if a != 0:
		return False
	else:
		return True


def check_for_factor(base, factor):
	a = base % factor
	if a == 0:
		c = True
	else:
		c = False
	return c


def check_for_factor(base, factor):
	ls = []
	for i in range(1, base + 1):
		if base % i == 0:
			ls.append(i)
	if factor in ls:
		return True
	else:
		return False


check_for_factor = lambda base, factor: True if not base % factor else False


check_for_factor = lambda b, f: not bool(b % f)


def check_for_factor(base, factor):
	return base // factor == base / factor


def check_for_factor(base, factor):
	resultat = False
	if base % factor == 0:
		resultat = True
	return resultat


def check_for_factor(base, factor):
	x = 0
	return 1 if base % factor == x else 0


check_for_factor = lambda b, f: True if b % f == 0 else False


def check_for_factor(b, f):
	if b % f == 0:
		return True
	else:
		return False


def check_for_factor(base: int, factor: int) -> bool:
	return base % factor == 0


check_for_factor = lambda x, y: not x % y


def check_for_factor(base, factor):
	return True if float(base) / factor == base // factor else False