20 lines
637 B
Python
20 lines
637 B
Python
def divide_by_one(num): # Is whole number
|
|
return float(num).is_integer()
|
|
|
|
def divide_by_two(num): # Take last digit, divide by two only on that
|
|
return _get_last_digit(num) % 2 == 0
|
|
|
|
def divide_by_three(num): # Sum each digit in number, then check divisibility of that number
|
|
num_string = f"{num}"
|
|
num_sum = 0
|
|
for digit_char in num_string:
|
|
num_sum += int(digit_char)
|
|
return num_sum % 3 == 0
|
|
|
|
def divide_by_five(num): # If last digit is a zero or a five return true
|
|
last_digit = _get_last_digit(num)
|
|
return last_digit == 0 or last_digit == 5
|
|
|
|
def _get_last_digit(num):
|
|
return int(f"{num}"[-1])
|
|
|