Shape and Reshape

Sort by

recency

|

376 Discussions

|

  • + 0 comments
    import numpy
    
    dimentions = list(map(int,input().split()))
    
    arr = numpy.array(dimentions)
    arr.shape = (3,3)
    
    print(arr)
    
  • + 0 comments

    For Python3 Platform

    import numpy
    
    arr = [*map(int, input().split())]
    arr = numpy.array(arr)
    
    print(numpy.reshape(arr, (3, 3)))
    
  • + 0 comments

    def reshape(arr): arr1 = numpy.array(arr) res = numpy.reshape(arr1,(3,3)) return res

    arr = list(map(int,input().split())) print(reshape(arr))

  • + 0 comments

    import numpy import sys

    chars = sys.stdin.read().split() arr = numpy.array([int(char) for char in chars]) arr.shape = (3,3) print(arr)

  • + 0 comments

    import numpy

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

    change_array=numpy.array(arr) change_array=change_array.reshape(3,3) print(change_array)