#Example 23_1
import math
#To find the focal length of the reading glasses
d1=25.0 #units in cm
d2=-75 #units in cm
f=(d1*d2)/(d2+d1) #Units in cm
print "The focal length of the reading glasses is f=",round(f,2)," cm"
#Example 23_2
import math
#To find the focal length of the corrective lens
d1=-50.0 #units in cm
f=-(d1) #Units in cm
print "The focal length of the corrective lens is f=",round(f)," cm"
#Example 23_3
import math
#To find the focal length of the combination
d1=20.0 #units in cm
d2=-30.0 #units in cm
d3=60.0 #units in cm
p1=100/d1 #units in dipoters
p2=100/d2 #units in dipoters
p3=100/d3 #units in dipoters
p=1/(p1+p2+p3) #Units in diopters
print "The combined focal length is=",round(p,1)," cm"