Write Python program for sum of series

55 pts.
Tags:
Python
How can I write a Python program to find the sum of the this series: - X - X**2/2! + X**3/3! - X**4/4! + X**5/5! - X**6/6! Thanks!
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 12  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen
    Truly this is homework and you have to try it by reading your study books. Or you can navigate python.org for learning more.
    141,290 pointsBadges:
    report
  • Nilesh1999
    Well My Source Code Has Some Syntax Error Except For Indentations. That's why I had asked for a proper source code for the given question.
    55 pointsBadges:
    report
  • Nilesh1999
    X = int(raw_input("Enter the value for x:"))
    j = int(raw_input("Enter The value for j:"))
    Sum = 0
    Fact = 1
    Sign = 1
    for i in range(1,x+1):
    for i in range(1,j+1):
    Fact = Fact*1
    Sum += (Sign*(X**i)/Fact*j
    55 pointsBadges:
    report
  • Nilesh1999
    There is syntax error in the following source code(Except for indentations). Even if you correct them, there still persists some syntax errors. Please help me correct them.
    55 pointsBadges:
    report
  • carlosdl
    You should post the exact error messages you are getting. That is always a must-do thing when asking for help on technical problems.
    85,470 pointsBadges:
    report
  • Nilesh1999
    X = int(raw_input("Enter the value for x:"))
    j = int(raw_input("Enter The value for j:"))
    Sum = 0
    Fact = 1
    Sign = 1
    for i in range(1,x+1):
    for i in range(1,j+1):
    Fact = Fact*1
    Sum += (Sign*(X**i)/Fact*j
    Here, a red mark comes saying there is a syntax error
    55 pointsBadges:
    report
  • carlosdl
    Where exactly is "here"?
    85,470 pointsBadges:
    report
  • Nilesh1999
    Okay never mind, can you please write a proper source code for this program and post it :)
    55 pointsBadges:
    report
  • carlosdl
    The problem is that it is your homework, and we should not do it for you.

    It is easy to ask for help the right way, when it comes to homework questions:

    Post your code, as you did, then tell us the exact problem you are having, and if you are getting errors, post the exact and complete error message you are getting, and if possible, the line of code that is causing the problem or being reported as incorrect.

    Then we can try to help you without doing the whole work for you.

    Does it make sense?
    85,470 pointsBadges:
    report
  • ToddN2000
    Your last line is missing the close parenthesis

    Sum += (Sign*(X**i)/Fact*j)
    135,495 pointsBadges:
    report
  • JustinWilson07
    Why don't you refer the tutorials available online related to this and I am sure you will find the solution.
    2,465 pointsBadges:
    report
  • SitdRKL14
    # Sum of the this series:- X - X**2/2! + X**3/3! - X**4/4! + X**5/5! - X**6/6!
    x = int(input("Enter the value for x:"))
    #j = int(input("Enter The value for j:"))
    Sum = 0
    Fact = 1
    Sign = 1
    for i in range(1,x+1):
    #    for j in range(1,j+1):
            Fact = Fact*1
    Sum += (Sign*(x**i)/Fact*i)
    print(Sum)

    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: