Skip to content

Instantly share code, notes, and snippets.

@ri-sh
Created September 8, 2015 15:18
Show Gist options
  • Save ri-sh/0a712d8712e163811e7e to your computer and use it in GitHub Desktop.
Save ri-sh/0a712d8712e163811e7e to your computer and use it in GitHub Desktop.
work
def factorial (n ):
if n<= 1 :
return 1
fact = 1
for i in range(1,n+1):
fact = fact*i
return fact
X=input('enter the value of x')
sum= 0
for i in range (1,5):
k= (-1)**(i-1)
sum +=k*((X**i)/factorial(i))
print sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment