Zeros and Ones

Sort by

recency

|

315 Discussions

|

  • + 0 comments

    import numpy as np x = list(map(int,input().strip().split())) arr1 = np.ones(x,dtype=int) arr2 = np.zeros(x,dtype=int) print(arr2, arr1, sep='\n')

  • + 0 comments

    It's awesome to see learners share tips and insights—makes understanding concepts like shape, dtype, and multidimensional arrays so much easier! 11x play

  • + 0 comments

    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)

  • + 0 comments

    Here is HackerRank Zeros and Ones in Python solution - https://programmingoneonone.com/hackerrank-zeros-and-ones-problem-solution-in-python.html

  • + 0 comments
    import numpy as np
    
    shape = tuple(map(int, input().split()))
    
    print(np.zeros(shape, dtype = int))
    print(np.ones(shape, dtype = int))