In [1]:

```
#Variable declaration
I =.000018; # Electric current, A
V = 15000; # Electric potential, V
P = 250000000 # Electric Power, W
#Calculations&Results
# Display standard form
print "Standard form:"
print "=============="
print "%f A = %3.1e A"%(I, I)
print "%5.0f V = %3.1e V"%(V, V)
print "%9.0f W = %3.1e W"%(P, P)
# Display scientific notation
print "\n\nScientific form:"
print "================"
print "%f A = %2d micro-ampere"%(I, I/1e-06)
print "%5.0f V = %2d kilo-volt"%(V, V/1e+03)
print "%9.0f W = %3d mega-watt"%(P, P/1e+06)
```

In [2]:

```
#Variable declaration
I = 25e-05; # Electric Current,A
P = 3e-04; # Electric Power, W
W = 850000.; # Work done, J
V = 0.0016; # Electric Potential, V
#Calculations&Results
print "Scientific (Engineering) notation:";
print "===================================";
print "%2e A = %3d micro-ampere = %3.2f mA"%(I, I/1e-06, I/1e-03);
print "%1.0e W = %.e milli-watt"%(P, P/1e-03);
print "%6d J = %3d kJ = %3.2f MJ"%(W, W/1e+03, W/1e+06);
print "%5.4f V = %3.1f milli-volt"%(V, V/1e-03)
```

In [3]:

```
#Variable declaration
m = 750/1e+03; # Mass of the body, kg
F = 2; # Force acting on the mass, N
#Calculations
# Since F = m * a, (Newton's Second Law of motion), solving for a
a = F/m; # Acceleration produced in the body, metre per second square
# Result
print "The acceleration produced in the body = %5.3f metre per second square"%a
```

In [4]:

```
#Variable declaration
Q = 35e-03; # Electric charge, C
t = 20e-03; # Time for transference of charge between two points, s
#Calculations
# Since Q = I * t, solving for I
I = Q/t; # Electric current flowing between the two points, A
# Result
print "The value of electric current flowing = %4.2f A"%I
```

In [5]:

```
#Variable declaration
I = 120e-06; # Electric current, A
t = 15; # Time for transference of charge between two points, s
#Calculations
# Since I = Q/t, solving for Q
Q = I*t; # Electric charge transferred, C
# Result
print "The value of electric charge transferred = %3.1f mC"%(Q/1e-03)
```

In [6]:

```
#Variable declaration
Q = 80; # Electric charge, C
I = 0.5; # Electric current, A
#Calculations
# Since Q = I*t, solving for t
t = Q/I; # Time for transference of charge between two points, s
# Result
print "The duration of time for which the current flowed = %3d s"%t
```

In [7]:

```
#Variable declaration
I = 5.5e-03; # Electric current, A
R = 33000; # Resistance, ohms
#Calculations
# From Ohm's law, V = I*R
V = I*R; # Potential difference across resistor, V
# Result
print "The potential difference developed across resistor = %5.1f V"%V
```

In [8]:

```
#Variable declaration
V = 24.; # Potential difference,V
R = 15; # Resistance, ohms
#Calculations
# From Ohm's law, V = I*R, then solving for I
I = V/R; # Electric current, A
# Result
print "The current flowing through the resistor = %3.1f A"%I
```

In [9]:

```
#Variable declaration
E = 6; # E.m.f of battery, V
r = 0.15; # Internal resistance of battery, ohm
I_1 = .5; # Electric current, A
I_2 = 2; # Electric current, A
I_3 = 10; # Electric current, A
#Calculations
# Using relation V = E - I*R and substituting the values of I_1, I_2 and I_3 one by one in it
V_1 = E - I_1*r; # Terminal potential difference, V
V_2 = E - I_2*r; # Terminal potential difference, V
V_3 = E - I_3*r; # Terminal potential difference, V
# Results
print "The terminal potential difference developed across resistor for a current of %3.1f A = %5.3f V"%(I_1,V_1)
print "The terminal potential difference developed across resistor for a current of %1d A = %3.1f V"%(I_2,V_2)
print "The terminal potential difference developed across resistor for a current of %2d A = %3.1f V"%(I_3,V_3)
```

In [10]:

```
#Variable declaration
E = 12; # E.m.f, V
I = 5; # Electric current, A
V = 11.5; # Terminal potential difference, V
#Calculations
# Using relation V = E - I*r, solving for r
r = ( E - V )/I; # Internal resistance of battery, ohm
# From Ohm's law, V = I*R, then solving for R
R = V/I; # Resistance, ohms
# Results
print "The internal resistance of battery = %3.1f ohm"%r
print "The resistance of external circuit = %3.1f ohm"%R
```

In [11]:

```
#Variable declaration
I = 200e-03; # Electric current, A
t = 300; # Time for which current flows, s
R = 750; # Resistance, ohms
#Calculations
# Using Ohm's law, V = I*R
V = I*R; # Electric potential difference, V
W = I**2*R*t; # Energy dissipated, joule
# Result
print "The potential difference developed across the resistor = %3d V\nThe energy dissipated across the resistor = %4.0f J or %1d kJ"%(V, W, W*1e-03)
```

In [21]:

```
import math
#Variable declaration
R = 680; # Resistance, ohms
P = 85e-03; # Electric power, W
#Calculations
# Using P = V**2/R, solving for V
V = math.sqrt( P*R ); # Potential difference, V
# Using P = I**2*R, solving for I
I = math.sqrt( P/R ); # Electric current, A
# Result
print "The potential difference developed across the resistance = %3.1f V\nThe current flowing through the resistor = %5.2f mA"%(V, I/1e-03)
```

In [13]:

```
#Variable declaration
I = 1.4; # Electric current, A
t = 900; # Time for which current flows, s
W = 200000; # Energy dissipated, J
#Calculations
# Using relation W = V*I*t, solving for V
V = W/( I*t ); # Potential difference, V
# Using relation P = V*I
P = V*I; # Electric power, W
# From Ohm's law, V = I*R, solving for R
R = V/I; # Resistance, ohm
# Result
print "The potential difference developed = %5.1f V\nThe power dissipated = %5.1f W\nThe resistance of the circuit = %5.1f ohm"%(V, P, R)
```

In [14]:

```
#Variable declaration
P = 12.5; # Power of the machine, kW
t = 8.5; # Time for which the machine is operated, h
#Calculations
W = P*t; # Electric energy, kWh
# Cost per unit = 7.902 p, therefore calculating the cost of 106.25 units
cost = ( W*7.902 ); # Cost for operating machine, p
# Result
print "The cost of operating the machine = %4.2f pounds"%(cost*1e-02)
```

In [15]:

```
#Variable declaration
Total_bill = 78.75; # pounds
Standing_charge = 15.00; # pounds
Units_used = 750; # kWh
#Calculations
Cost_per_unit = ( Total_bill - Standing_charge )/Units_used; # p
Cost_of_energy_used = 67.50; # pounds
Total_bill = Cost_of_energy_used + Standing_charge; # pounds
# Result
print "The cost per unit = %5.3f pounds or %3.1f p\nTotal bill = %5.2f pounds"%(Cost_per_unit,Cost_per_unit/1e-02,Total_bill)
```

In [16]:

```
#Variable declaration
l = 200; # Length of Cu wire, metre
rho = 2e-08; # Resistivity of Cu, ohm-metre
A = 8e-07; # Cross sectional area of Cu wire, metre square
#Calculations
# Using relation R = ( rho*l )/A
R = ( rho*l )/A; # Resistance, ohm
# Result
print "The resistance of the coil = %1d ohm"%R
```

In [22]:

```
import math
#Variable declaration
l = 250; # Length of Cu wire, metre
d = 5e-04; # Diameter of Cu wire, metre
rho = 1.8e-08; # Resistivity of Cu wire, ohm-metre
#Calculations
A = (math.pi*d**2 )/4; # Cross sectional area of Cu wire, metre square
# Using relation R = rho*l/A
R = rho*l/A; # Resistance, ohm
# Result
print "The resistance of the coil = %5.2f ohm"%R
```

In [18]:

```
#Variable declaration
R_1 = 250; # Resistance of field coil, ohm
Theta_1 = 15; # Initial temperature of motor, degree celcius
Theta_2 = 45; # Final temperature of motor, degree celcius
Alpha = 4.28e-03; # Temperature coefficient of resistance, per degree celcius
#Calculations
# Using relation, R_1/R_2 = ( 1 + Alpha*Theta_1 )/( 1 + Alpha*Theta_2 ), solving for R_2
R_2 = R_1 * (( 1 + Alpha*Theta_2 )/( 1 + Alpha*Theta_1 )); # Resistance, ohms
# Result
print "The resistance of field coil at %2d degree celcius = %5.1f ohm"%(Theta_2, R_2)
```

In [19]:

```
#Variable declaration
R_0 = 350; # Resistance, ohms
Theta_1 = 60; # Temperature, degree celcius
Alpha = 4.26e-03; # Temperature coefficient, per degree celcius
#Calculations
# Using relation R_1 = R_0 * ( 1 + Alpha*Theta_1 )
R_1 = R_0 * ( 1 + Alpha*Theta_1 ); # Resistance, ohms
# Result
print "The resistance of the wire at %2d degree celcius = %5.1f ohm"%(Theta_1, R_1)
```

In [20]:

```
#Variable declaration
R_1 = 120; # Resistance, ohms
Theta_1 = 16; # Temperature, degree celcius
Theta_2 = 32; # Temperature, degree celcius
Alpha = -4.8e-04; # Temperature coefficient, per degree celcius
#Calculations
# Using relation, R_1/R_2 = ( 1 + Alpha*Theta_1 )/( 1 + Alpha*Theta_2 ), solving for R_2
R_2 = R_1 * (( 1 + Alpha*Theta_2 )/( 1 + Alpha*Theta_1 )); # Resistance, ohm
# Result
print "The resistance of carbon resistor at %2d degree celcius = %5.1f ohm"%(Theta_2, R_2)
```