Zeros and Ones

Sort by

recency

|

322 Discussions

|

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

    just FYI, numpy.int no longer works, it has be to int for dtype

    import numpy
    
    dims = tuple(map(int, input().split()))
    
    print(numpy.zeros(dims, dtype = int))
    print(numpy.ones(dims, dtype = int))
    
  • + 0 comments
    import numpy as np
    needs = ['zeros','ones']
    ip = list(map(int,input().split()))
    for _ in needs:
        print(getattr(np,_)(ip,dtype=int))
    
  • + 0 comments
    import numpy
    l=list(map(int,input().split()))
    print(numpy.zeros((l),dtype=int))
    print(numpy.ones((l),dtype=int))
        
    
  • + 0 comments

    import numpy as np n = tuple(map(int, input().split()))

    print(np.zeros(n).astype(int)) print(np.ones(n).astype(int))