Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import factorial
- n = int(input())
- x = float(input())
- s = 1 # complex sum
- k = 1 # exponent of x
- factorial = 1
- for i in range(1, n + 1):
- factorial = factorial * i
- s = s + (factorial / x ** k)
- k = k + 1
- if k == n + 1:
- break
- print(f'{s:.5f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement