import math
#variable declaration
v1 = 100; #first stage voltage gain
v2 = 200; #second stage voltage gain
v3 = 400; #third stage voltage gain
#calculations
V1 = 20*math.log10(v1); #first stage voltage gain in dB
V2 = 20*math.log10(v2); #second stage voltage gain in dB
V3 = 20*math.log10(v3); #third stage voltage gain in dB
V = V1+V2+V3; #total voltage gain in dB
#result
print'total voltage gain = %d'%V,'dB';
import math
#variable declaration
G = 30; #absolute power gain
n = 5; #number of stages
G1 = 10; #negative feedback gain in dB
#calculations
p1 = 10*math.log10(G); #power gain of first stage in dB
pt = n*p1; #total power gain in dB
pr = pt-G1; #resultant power gain with negative feedback in dB
#result
print'total power gain %2.2f'%pt,'dB';
print'resultant power gain %2.2f'%pr,'dB';