import math
#Variable declaration
l = 20.0 #Length of shaft(cm)
d = 10.0 #Diameter of shaft(cm)
thick = 1.5 #Layer of nickel(mm)
J = 195.0 #Current density(A/sq.m)
n_I = 0.92 #Current efficiency
g = 8.9 #Specific gravity of nickel
#Calculation
Wt = math.pi*l*d*thick/10*g*10**-3 #Weight of nickel to be deposited(kg)
ece_nickel = 1.0954 #Electro-chemical equivalent of nickel(kg/1000 Ah)
Q_I = Wt*1000/(ece_nickel*n_I) #Quantity of electricity required(Ah)
time = Q_I/(math.pi*l*d*10**-4*J) #Time taken(hours)
#Result
print('Quantity of electricity = %.f Ah' %Q_I)
print('Time taken for the process = %.f hours' %time)
#Variable declaration
no_cells = 600.0 #Number of cells employed for copper refining
I = 4000.0 #Current(A)
V = 0.3 #Voltage per cell(V)
hour = 90.0 #Time of plant operation(hours)
ece_cu = 1.1844 #Electro-chemical equivalent of copper(kg/1000 Ah)
#Calculation
Ah_week = I*hour #Ah per week per cell
Ah_year = Ah_week*52 #Ah per year per cell
Wt = no_cells*ece_cu*Ah_year/(1000*10**3) #Weight of copper refined per year(tonnes)
energy = V*I*no_cells*hour*52/1000 #Energy consumed(kWh)
consumption = energy/Wt #Consumption(kWh/tonne)
#Result
print('Annual output of refined copper = %.f tonnes' %Wt)
print('Energy consumption = %.1f kWh/tonne' %consumption)
print('\nNOTE: ERROR: Substitution & calculation mistake in the textbook solution')
#Variable declaration
hour = 24.0 #Time(hour)
I = 3500.0 #Average current(A)
n = 0.9 #Current efficiency
valency = 3.0 #Aluminium valency
w = 27.0 #Atomic weight of aluminium
ece_Ag = 107.98 #Electro-chemical equivalent of silver
Wt_dep = 0.00111 #Silver deposition by one coulomb(gm)
#Calculation
chemical_eq_Al = w/valency #Chemical equivalent of aluminium
eme_Al = Wt_dep/ece_Ag*chemical_eq_Al #Electro-chemical equivalent of aluminium(gm/coulomb)
Wt_Al_liberated = I*hour*3600*n*eme_Al/1000 #Weight of aluminium liberated(Kg)
#Result
print('Weight of aluminium produced from aluminium oxide = %.1f kg' %Wt_Al_liberated)