M=2.5 #mass of the substance[Kg]
x=0.6 #mass fraction for vapour phase
P=7 #pressure [atm]
T=438 #temperature[K]
Ml=(1-x)*M #mass fraction of liquid phase[Kg]
Mg=x*M #mass fraction of vapour phase[Kg]
print"M(liquid phase)=",Ml,"Kg\nM(vapour phase)=",Mg,"Kg"
Vl=0.0177 #specific volume of saturated liquid[m3/Kg]
Vg=4.43 #specific volume of saturated vapour[m3/Kg]
P=7 #pressure[atm]
T=438 #temperature[K]
x=0.6 #fraction of vapour phase
M=2.5 #mass of the substance[Kg]
V=((1-x)*Vl+x*Vg)*M #total volume occupied [m3]
print"Total volume occupied =",round(V,2),"m^3"
M=2.5 #mass of a substance[Kg]
x=0.6 #fraction of vapour phase
Ug=1105.0 #specific internal energy of saturated vapour[J/Kg]
Ul=298.0 #specific internal energy of saturated liquid[J/Kg]
U=M*((1-x)*Ul+x*Ug)
print"The total internal energy of the mixture =",U,"J"
print"\nNOTE:In textbook,it is wrongly calculated as 1950 J"