Problem Statement
A mixing tank with a volume of 10 liters contains a salt solution at a concentration of 120 g/L. If salt-free water is continuously fed into this tank at the rate of 15 L/h, and the volume is maintained constant by continuously overflowing the excess fluid, what will be the concentration of salt after 90 min.
Solution
def salt_in_g(volume, concentration): grams = volume * concentration return grams def in_flow(water_in_l, delta_t): volume_add = water_in_l_h * delta_t return volume_add volume = 10 concentration = 120 total_grams = salt_in_g(10, 120) water_in_l_h = 15 delta_t = 1 / 216000 for _ in range(1, 90*60*60): gram_out = salt_in_g(in_flow(water_in_l_h, delta_t), concentration) total_grams = total_grams - gram_out concentration = total_grams / volume print(concentration)
- Run it in your browser here
Top comments (0)