In [2]:

```
from __future__ import division
#given
#density of nickel and nickel oxide (NiO)
rhom=8900 #kg/m**3
rhoc=7080 #kg/m**3
#molecular weight of nickel and nickel oxide
Mm=58.51
Mc=74.71
#molar volumes are
Vm=Mm/rhom #m**3/mol
Vc=Mc/rhoc #m**3/mol
if Vc>Vm:
print " it is clear that Vc>Vm, so a protective film will form over nickel"
else :
print " it is clear that Vc<Vm, so a protective film will not form over nickel"
```

In [7]:

```
from math import sqrt
#given
#oxidation loss on the copper surface is 0.1 mm in 25 hours
t1=25 #hours
x1=0.1 #mm
#to find the loss in 300 hours
t2=300 #hours
# as we know that oxidation loss is given by
#x**2=Cp*t
#for t1 and t2 we have following equations
#x1**2=Cp*t1 -------(1)
#x2**2=Cp*t2 -----------(2)
#dividing equation 1 by 2
#we get
x2=x1*sqrt(t2/t1) #mm
print "Loss in 300 hours is %0.3f mm"%(x2)
```

In [4]:

```
#given
#atomic weight and density of magnesium
MMg=24.3 #gm
rhoMg=1.740 #g/cm**3
#molecular weight and density of MgO
MMgO=40.3 #gm
rhoMgO=3.650 #g/cm**3
#volume of Mg and Mgo
VMg=MMg/rhoMg #cm**3
VMgO=MMgO/rhoMgO #cm**3
#we know that pilling-bedworth ratio is given by
PBR=VMgO/VMg
if PBR<1:
print "Since PBR is less than 1 so the film formed is not protective "
else:
print "Since PBR is greater than 1 so the film formed is protective "
```

In [8]:

```
#given
#one mole of magnesium weighs
MMg=0.0243 #Kg
#current density
I=20*10**-3 #A/m**2
#design life of 15 years
t=15*365*24*3600 #sec
#charge= 2 faradya
Q=2*96490 #C
#charge needed per m**2 of structure's for design life
q=I*t #A s
#the amount of magnesium needed
AMg=MMg*q/Q #kg/m**2
print "the amount of magnesiun meeded is %0.3f kg/m**2"%(AMg)
```