sum func

Here is my solution for one of the first homework problems in CSci 1901, but in Python.

def sumfunc(a, b, c):
    if a >= c and b >= c:
        return (a + b) / c
    else:
        return sumfunc(b, c, a)

print sumfunc(8, 6, 2)
print sumfunc(3, 5, 4)
print sumfunc(9, 9, 9)
Advertisements