Zeros and Ones

Sort by

recency

|

298 Discussions

|

  • + 0 comments

    import numpy as np

    a = input().strip() b = list(map(int,a.split()))

    zeros_array = np.zeros(b, dtype=int) ones_array = np.ones(b, dtype=int)

    Print the arrays

    print(zeros_array) print(ones_array)

  • + 0 comments

    import numpy as np

    M = list(map(int, input().split()))

    print(np.zeros(M, dtype=int)) print(np.ones(M, dtype=int))

  • + 0 comments

    import numpy as np

    def zero_one(x): list_zero_one = ['zeros','ones'] for i in list_zero_one: func = getattr(np, i) print(func(tuple(x), int))

    inputs = list(map(int, input().split())) zero_one(inputs)

  • + 0 comments

    Zeros and Ones(Create array)

    import numpy as np l = list(map(int, input().split()))

    zerosArr = np.array(list(np.zeros(([i for i in l]),dtype=int))) onesArr = np.array(list(np.ones(([i for i in l]),dtype=int))) print(zerosArr) print(onesArr)

  • + 0 comments

    import numpy

    l=list(map(int,input().split())) a=numpy.zeros(([i for i in l]),dtype=numpy.int64) b=numpy.ones(([i for i in l]),dtype=numpy.int64) print(a) print(b)