Zeros and Ones

Sort by

recency

|

314 Discussions

|

  • + 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))
    
  • + 0 comments

    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 :)