Chapter 2 - Basic concepts

Example 2 pg 11

In [3]:
import math
##calculate the mass of oxygen and density of oxygen and specific volume and molar specific volume
##initialisation of variables
n= 0.25 ## k mol
M= 32 ##kg/kmol
V= 0.5 ##m^3
##CALCULATIONS
m= n*M
d= m/V
v= 1/d
v1= V/n
##RESULTS
print'%s %.0f %s'%("mass of oxygen=",m,'kg')
print'%s %.0f %s'%("density of oxygen=",d,'kg/m^3')
print'%s %.4f %s'%('specific volume=',v,'kg/m^3')
print'%s %.0f %s'%('molar specific volume=',v1,'m^3/kmol')
mass of oxygen= 8 kg
density of oxygen= 16 kg/m^3
specific volume= 0.0625 kg/m^3
molar specific volume= 2 m^3/kmol