Zeros and Ones

Sort by

recency

|

313 Discussions

|

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

  • + 0 comments

    import numpy as np

    n = input()

    l1 = list(map(int,n.split(' ')))

    arr = np.zeros((l1),dtype=int) print(arr) arr = np.ones((l1),dtype=int) print(arr)