Python on emacs

Elpy is the best Python IDE so far!

I installed it with use-package.

use-package is installed using M-x package-install.

#!/usr/bin/env python

import math

# C-c C-c evaluates
# C-c C-z shows the python interperter
# Completions:
#   1. writing 'env' then TAB expands to the shebang
#   2. similarly, 'def' then TAB
#   3. uses yasnippets for competions. It comes with it
# C-c C-e for refactoring

def fact(n):
    nlist=[k for k in range(1,n+1)]
    p=1
    for k in nlist:
       p=k*p

    return p

def handexp(x):
    s=0
    for k in range(15):
        newterm=x**k/math.factorial(k)
        s=s+newterm

    return s

print(math.exp(8))
print(handexp(8))
print(fact(10))
print(math.factorial(10))