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
|
314 Discussions
|
Please Login in order to post a comment
It's awesome to see learners share tips and insights—makes understanding concepts like shape, dtype, and multidimensional arrays so much easier! 11x play
BY GK import numpy
arr = input().strip().split(' ') array = numpy.array(arr,dtype="int32")
N1 = numpy.zeros(array,dtype="int32") print(N1)
N1 = numpy.ones(array,dtype="int32") print(N1)
Here is HackerRank Zeros and Ones in Python solution - https://programmingoneonone.com/hackerrank-zeros-and-ones-problem-solution-in-python.html
import numpy user_input = input().split() d =tuple(map(int,user_input)) print(numpy.zeros((d),dtype = 'int')) print(numpy.ones((d),dtype = 'int'))
Here is the solution :)