In [1]:

```
import math
# Variables
D = 320*10**-3; #in meter
L = 1; #in meter
# Calculation
A = math.pi*D*L; #Surface area in meter**2
l = (200/A);
# Results
print 'the distance at which magnisium anode capable of giving 2MA = %.0f meters'%l
```

In [2]:

```
import math
# Variables
W = 0.0243; #1 mole of magnesium weight(in Kg)
C = 2*96490; #used charge (in A-s)
A = 15*10**(-3); #current density (in A/metre2)
t = 10; #time (in years)
T = 10*365*24*3600; #time (in sec)
# Calculation
#amount of magnesium required = charge required per m2 of hull surface for a design life of 10 years/(used charge for anode)
Mg_required = W*A*T/C; #magnesium required per square meter of the hull surface for a design life of 10 years
# Results
print 'magnesium required per square meter of the hull surface for a design life of 10 years = %.1f Kg/m2'%Mg_required
```