i m new to python and its great!. but i m facing difficulties in finding the result of this series:

```
 1-x+(x^2)/2!-(x^3)/3!+(x^4)/4!-..............up to n terms

```

what i wrote was:

```
  import math
  a=input("ENter the no")
  x=input("ENter value of x")
  i=1
  s=0
  s1=0
  s2=1
  p=1
  while(i<=a):
          if(i%2!=0):
                    s=s-math.pow(x,i)/p*i
          else:
                     s1=s1+math.pow(x,i)/p*i
          i=i+1
  else:
              s2=s2+s1+s
              print s2

```

please let me know of the correct program and the mistakes:)!! Thanks in advance.
let me know it without directly using the factorial function?