Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Foo

Project: Foo
Path: foo.ipynb
Views: 23
Kernel: Python 3 (Anaconda)

Programming concepts Introduced using Python and a simple actuarial example

Arithmetic: addition (+), subtraction (-), division (/), and multiplication (*)

1+2-3*4/5
0.6000000000000001
def a(i,n): return (1-(1+i)**-n)/i
a(0.02,10)
8.982585006242244
a(0,10)
--------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) <ipython-input-4-532c08013ec5> in <module>() ----> 1 a(0,10) <ipython-input-2-02cd6a5a876f> in a(i, n) 1 def a(i,n): ----> 2 return (1-(1+i)**-n)/i ZeroDivisionError: float division by zero
def b(i,n): if i==0: return n else: return