Skip to content

Instantly share code, notes, and snippets.

@AFAgarap
Created May 20, 2016 06:00
Show Gist options
  • Save AFAgarap/a45e0427dd1764c69ac2548d32f1e7ac to your computer and use it in GitHub Desktop.
Save AFAgarap/a45e0427dd1764c69ac2548d32f1e7ac to your computer and use it in GitHub Desktop.
Maclaurin series for e^x
def main():
print("\t\t\t10th degree of Maclaurin Series, e^x")
x = float(input("Enter value of x: "))
answer = 1; i = 1
while(i < 10):
answer += (x ** i) / factorial(i)
i += 1
print(answer)
def factorial(number):
return 1 if (number == 0) else (number * factorial(number - 1))
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment