Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- def getInitialisedArray():
- return np.empty((), dtype=np.float).tolist()
- def createFloatArray(x):
- return np.array(float(x))
- >>> getInitialisedArray()
- 0.007812501848093234
- >>> createFloatArray(3.1415)
- 3.1415
- print(getInitialisedArray())
- print(createFloatArray(3.1415))
- print(getInitialisedArray())
- >>>
- 0.007812501848093234
- 3.1415
- 3.1415
- import numpy as np
- def getInitialisedArray():
- # Changed size to 2 x 2
- return np.empty((2, 2), dtype=np.float).tolist()
- def createFloatArray(x):
- return np.array(float(x))
- print(getInitialisedArray())
- print(createFloatArray(3.1415))
- print(getInitialisedArray())
- [[1.6717403e-316, 6.9051865033801e-310], [9.97338022253e-313, 2.482735075993e-312]]
- 3.1415
- [[1.6717403e-316, 6.9051865033801e-310], [9.97338022253e-313, 2.482735075993e-312]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement