SHARE
TWEET

Untitled

a guest Jun 16th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2.  
  3. def getInitialisedArray():
  4.     return np.empty((), dtype=np.float).tolist()
  5.  
  6. def createFloatArray(x):
  7.     return np.array(float(x))
  8.      
  9. >>> getInitialisedArray()
  10. 0.007812501848093234
  11.      
  12. >>> createFloatArray(3.1415)
  13. 3.1415
  14.      
  15. print(getInitialisedArray())
  16. print(createFloatArray(3.1415))
  17. print(getInitialisedArray())
  18.      
  19. >>>
  20. 0.007812501848093234
  21. 3.1415
  22. 3.1415
  23.      
  24. import numpy as np
  25.  
  26. def getInitialisedArray():
  27.     # Changed size to 2 x 2
  28.     return np.empty((2, 2), dtype=np.float).tolist()
  29.  
  30. def createFloatArray(x):
  31.     return np.array(float(x))
  32.  
  33. print(getInitialisedArray())
  34. print(createFloatArray(3.1415))
  35. print(getInitialisedArray())
  36.      
  37. [[1.6717403e-316, 6.9051865033801e-310], [9.97338022253e-313, 2.482735075993e-312]]
  38. 3.1415
  39. [[1.6717403e-316, 6.9051865033801e-310], [9.97338022253e-313, 2.482735075993e-312]]
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