>>> def cylinder_volume(height, radius): pi = 3.14159 return height * pi * radius ** 2 >>> cylinder_volume(10, 3) 282.7431
def population_density(population, land_area): return population / land_area test1 = population_density(10, 1) expected_result1 = 10 print("expected result: {}, actual result: {}".format(expected_result1, test1)) test2 = population_density(864816, 121.4) expected_result2 = 7123.6902801 print("expected result: {}..., actual result: {}".format(expected_result2, test2))
def readable_timedelta(days): week = days / 7 day = days % 7 return "{} week(s) and {} day(s)".format(week, day) print(readable_timedelta(120))