SHARE
TWEET

Untitled

a guest Apr 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     def pI (self, precision = 2):
  2.         bestCharge = 100000000 #utilizes a large number so the conditional statement is always passed
  3.         bestPH = 0
  4.         PH = 0
  5.         r, l = 14, 0
  6.         x = 0
  7.         p = 1 * (10 ** (-1*precision))
  8.         while l <= r:
  9.             mid  = round((l + r)/2,precision)
  10.             thisCharge = self._charge_(mid)
  11.             if abs(thisCharge) < bestCharge :
  12.                 bestCharge = abs(thisCharge)
  13.                 bestPH = mid
  14.             if thisCharge > 0:
  15.                 l = mid + p
  16.             else:
  17.                 r = mid - p
  18.         return bestPH
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