Answer:
totally
awesome
Explanation:
You can evaluate the expressions in the statements by hand:
if (a*b!=c) evaluates to
if (2*3 != 11)
if (6 != 11)
if (true)
so the next line is executed (it prints 'totally')
Likewise, the other if statement also evaluates to true.
def dx(fn, x, delta=0.001):
return (fn(x+delta) - fn(x))/delta
def solve(fn, value, x=0.5, maxtries=1000, maxerr=0.00001):
for tries in xrange(maxtries):
err = fn(x) - value
if abs(err) < maxerr:
return x
slope = dx(fn, x)
x -= err/slope
raise ValueError('no solution found')