In [3]:

```
import math
m_i = 10. #[g]
m_w = 990. #[g]
M_i = 342.3 #[g]
M_w = 18. #[g]
x_i = m_i/(m_i+m_w)
x_i = x_i*100. # [in percentage]
n_i = m_i/M_i # number of moles of sucrose
n_w = m_w/M_w # number of moles of water
x_j = n_i/(n_i+n_w)
x_j = x_j*100 # [in percentage]
m = n_i/m_w*1000 #[molal]
x_ppm = x_i*10**(6)/100. #[ppm]
print " sucrose concentration in terms of the mass fraction is %f%%"%(x_i)
print " sucrose concentration in terms of the mole fraction is %f%%"%(x_j)
print " sucrose concentration in terms of the molality is %f molal"%(m)
print " sucrose concentration in terms of the ppm is %f ppm"%(x_ppm)
```

In [4]:

```
import math
T = 20. #[C]
d = 1.038143/1000*10.**(6) #[kg/m**(3)]
m_i = 10. #[g] mass of sucrose
M_i = 342.3 #[g/mol] molecular weight of sucrose
m = 1.00 #[kg]
V = m/d*1000 #[L]
m_1 = m_i/V #[g/L]
m_2 = (m_i/M_i)/V #[mol/L]
print " Mass concentration of the solution is %f g/L"%(m_1)
print " Mole concentration of the solution is %f mol/L"%(m_2)
print " Molarity of the solution is %f mol/L"%(m_2)
```

In [ ]:

```
```