Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Pure math solution in Clear category for Achilles and the Tortoise by H0r4c3
def chase(a1_speed, t2_speed, advantage):
adv_dist = t2_speed * advantage
diff_speed = a1_speed - t2_speed
result = adv_dist / diff_speed
print(result + advantage)
return result + advantage
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
def almost_equal(checked, correct, significant_digits):
precision = 0.1 ** significant_digits
return correct - precision < checked < correct + precision
assert almost_equal(chase(6, 3, 2), 4, 8), "example"
assert almost_equal(chase(10, 1, 10), 11.111111111, 8), "long number"
Feb. 23, 2022
Comments: