We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Zeros and Ones
- Discussions
Zeros and Ones
Zeros and Ones
Sort by
recency
|
323 Discussions
|
Please Login in order to post a comment
import numpy as np n = tuple(map(int, input().split()))
print(np.zeros(n).astype(int)) print(np.ones(n).astype(int))
For Python3 Platform
No need to use numpy.int. Just type "int" as this is being accepted in the new versions of numpy module. Hackerrank should take a look at the synopsis they have given for this problem
import numpy as np nums=tuple(map(int,input().split())) print(np.zeros(nums,dtype=int)) print(np.ones(nums,dtype=int))