SHARE
TWEET

Untitled

anon20016 Dec 6th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. handle = open("test.txt", "r")
  2. n = int(handle.readline())
  3. a = list(map(int, handle.readline().split()))
  4. handle.close()
  5. r = 0.0
  6. z = 1
  7. s = 0
  8. for i in range(n):
  9.     r = r + a[i]
  10.     z = z * a[i]
  11.  
  12. for i in range(n):
  13.     s = s + z / a[i]
  14.  
  15. r = r + s / z
  16.  
  17. f = open('text.txt', 'w')
  18. f.write("{:.9f}".format(r))
  19. f.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top