1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
def f(a, b):
return (a + b) / (a - b)
for a in range(0, 4):
for b in range(5, 9):
a = float(a)
b = float(b)
print("y = f(%d, %d) = %f" % (a, b, f(a, b)))
|
y = f(0, 6) = -1.000000
y = f(0, 7) = -1.000000
y = f(0, 8) = -1.000000
y = f(1, 5) = -1.500000
y = f(1, 6) = -1.400000
y = f(1, 7) = -1.333333
y = f(1, 8) = -1.285714
y = f(2, 5) = -2.333333
y = f(2, 6) = -2.000000
y = f(2, 7) = -1.800000
y = f(2, 8) = -1.666667
y = f(3, 5) = -4.000000
y = f(3, 6) = -3.000000
y = f(3, 7) = -2.500000
y = f(3, 8) = -2.200000 |