In [2]:

```
import math # Example17_1
#To find number of electrons flow through bulb
current=0.15 #Units in C
q=1.6*10**-19 #Units in C/electron
noe=current/q #Units in number of Electrons
print "The number of electrons that pass through bulb is="
print noe
print "electrons"
```

In [3]:

```
import math # Example17_2
#To find the resistance in bulb
v=1.55 #Units in V
i=0.08 #Units in A
r=v/i #Units in Ohms
print "The resistance in bulb is=",round(r,1)," Ohms"
```

In [4]:

```
import math # Example17_3
#To find the resistance in wire
row=1.7*10**-8 #Units in Ohm meter
l=40 #Units in meters
a=0.0331*10**-4 #Units in meters**2
r=(row*l)/a #Units in Ohms
print "The resistance in wire is=",round(r,3)," Ohms"
```

In [5]:

```
import math # Example17_4
#To find the appropriate resistance of the wire
alpha=0.0045 #Units in Centigrade**-1
t=1780 #Units in Centigrade
deltaR=240 #Units in Ohms
ro=deltaR/(1+(alpha*t)) #Units in ohms
print "The appropriate resistance in wire is Ro=",round(ro,1)," Ohms"
```

In [6]:

```
import math # Example17_5
#To find out the amount of heat developed in bulb
t=20.0*60 #Units in sec
pow=40.0 #Units in W
heat=t*pow #Units in J
print "Heat generated in bulb is=",round(heat)," J"
```

In [7]:

```
import math # Example17_6
#To calculate the cost needed to operate
power=0.7 #Units in KW
time=0.5 #Units in h
heat=power*time #Units in K Wh
cost=0.10 #Units in Dollars
tcost=cost*heat #Units in Dollars
print "Cost needed to operate is=",round(tcost,4)," Dollars"
```

In [8]:

```
import math # Example17_7
#To find the current in circuit
v1=3 #Units in V
v2=12.0#Units in V
r1=5.0 #Units in Ohms
r2=6 #Units in Ohms
i=(v1-v2)/(r1+r2) #Units in A
print "The current in circuit is I=",round(i,2)," A"
```

In [9]:

```
import math # Example17_8
#To find the current in all wires
v=9 #Units in V
r1=18.0 #Units in Ohms
i2=-v/r1 #Units in A
v1=6.0 #Units in V
r2=12.0 #Units in Ohms
i3=(v+v1)/r2 #Units in A
i1=i3-i2 #Units in A
print "Current in wire 1 is I1=",round(i1,2)," A\nCurrent in wire 2 is I2=",round(i2,2)," A\nCurrent in wire 3 is I3=",round(i3,2)," A\n"
```

In [12]:

```
import math # Example17_9
#To find the current I in the battery
r1=3 #Units in Ohms
r2=6.0 #Units in Ohms
rbc=(r1*r2)/(r1+r2)#Units in Ohms
r3=4#Units in Ohms
rac=r3+rbc #Units in Ohms
v=12.0 #Units in V
i=v/rac #Units in A
print "The current I=",round(i)," A"
```

In [15]:

```
import math # Example17_10
#To find the current in battery
r1=3.0 #Units in Ohms
r2=6.0 #Units in Ohms
ra=(r1*r2)/(r1+r2)#Units in Ohms
r3=2 #Units in Ohms
r4=4.0 #Units in Ohms
rb=r3+r4 #Units in Ohms
r5=6.0 #Units in Ohms
rc=(r5*rb)/(r5+rb) #Units in Ohms
r6=9.0 #Units in Ohms
r=r6+rc #Units in Ohms
v=6 #Units in V
i=v/r #Units in Ohms
print "The current in battery is I=",round(i,2)," A"
```

In [16]:

```
import math # Example17_11
#To find the current in the wires
v1=12.0 #Units in V
r3=20.0 #Units in Ohms
v2=6 #Units in V
r2=10.0 #Units in Ohms
r1=5 #Units in Ohms
i3=((v1*r3)-(v2*r1))/((r2*r3)+(r1*r3)+(r1*r2)) #Units in A
i2=((r2*i3)+v2)/r3 #Units in A
i1=i3+i2 #Units in A
print "Current in wire 1 is I1=",round(i1,1)," A\nCurrent in wire 2 is I2=",round(i2,1)," A\nCurrent in wire 3 is I3=",round(i3,1)," A\n"
```

In [17]:

```
import math # Example17_12
#To find I1, I2 and I3 in the circuit
v1=40 #Units in V
r1=10.0 #Units in Ohms
r2=30.0 #Units in Ohms
v2=60.0 #Units in V
r3=15.0 #Units in Ohms
v3=50 #Units in V
i1=((-v1*r2)+(-r3*v1)+(60*r3)+(v3*r2))/((r1*r2)+(r2*r3)+(r3*r1)) #Units in A
i=2 #Units in A
i2=(i-i1)/3 #Units in A
i3=i2-i1 #Units in A
print "Current in wire 1 is I1=",round(i1,3)," A\nCurrent in wire 2 is I2=",round(i2,3)," A\nCurrent in wire 3 is I3=",round(i3,3)," A\n"
```

In [18]:

```
import math # Example17_13
#To find the values of e, R and I
i1=2 #Units in A
i2=0.5 #Units in A
i=i1+i2 #Units in A
v1=6 #Units in V
v2=16.0 #Units in V
r=-(v1-v2)/0.5 #Units in Ohms
v3=25.0 #Units in V
e=v2+v3 #Units in V
print " The current I=",round(i,1)," A\n Resistance is R=",round(r)," Ohms\n The value E is=",round(e)," V"
```

In [19]:

```
import math # Example17_14
#To find the I1,I2,I3 values and charge on the capacitor
v1=12.0 #Units in V
r1=6.0 #Units in Ohms
i1=v1/r1 #Units in A
v2=4.0 #Units in V
r2=8.0 #Units in Ohms
i3=(v1+v2)/r2 #Units in A
i2=i1+i3 #Units in A
print "Current in wire 1 is I1=",round(i1)," A\nCurrent in wire 2 is I2=",round(i2)," A\nCurrent in wire 3 is I3=",round(i3)," A\n"
v3=10.0 #Units in V
vfg=-v3+(r1*i1) #Units in V
c=5*10**-6 #Units in F
q=c*vfg #Units in C
print "The charge on the capacitor is q=",round(q,5)," C"
```

In [20]:

```
import math # Example17_15
#To find the terminal potential of each battery
v=18 #Units in V
r=9 #Units in Ohms
i=v/r #Units in A
r1=0.1 #Units in Ohms
v1=-i*r1 #Units in V
v2=24 #Units in V
v11=v1+v2 #Units in V
r2=0.9 #Units in Ohms
v3=i*r2 #Units in V
v4=6 #Units in V
v22=v3+v4 #Units in V
print "The Potential difference between d to c is=",round(v11,1)," V"
print "\nThe potential difference between b to a is=",round(v22,1)," V"
```

In [21]:

```
import math # Example17_16
#To findout how large a a resistance must the recording device must have
r1=10000.0 #Units in Ohms
percent=1.0 #Units in Percentage
vo=1/(r1*(percent*100)) #Units In terms of Ro
Ro=1/vo #Units in Ohms
print "The resistance of the recording device is=",round(Ro)," Ohms"
```