# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
def salt_content(t):
    salt = 18 #pounds
    brine = 82 #gallons
    for i in range(t):
        brine += 5
        salt += 15
        concentration = salt/brine
        salt_out = 2*concentration
        salt -= salt_out
        brine -= 2
    print(i,brine,salt)
salt_content(39)

def salt_content(t,frac=0.001):
    salt = 18 #pounds
    brine = 82 #gallons
    for i in range(int(t/frac)):
        brine += 5*frac
        salt += 15*frac
        concentration = salt/brine
        salt_out = 2*concentration*frac
        salt -= salt_out
        brine -= 2*frac
    print(i,brine,salt)
salt_content(39)
# -



StarcoderdataJupyterScriptsDedupFiltered