Transpose and Flatten

Sort by

recency

|

322 Discussions

|

  • + 0 comments

    import numpy n,m = input().split() og=numpy.array([[s for s in map(int,input().split())] for _ in range(int(n))]) print(numpy.transpose(og)) print(og.flatten())

  • + 0 comments
    import numpy as np
    
    n, m = map(int, input().split())
    matrix = np.array([list(map(int, input().split())) for _ in range(n)])
    print(np.transpose(matrix))
    print(matrix.flatten())
    
  • + 0 comments

    import numpy as np

    n,m = input().split() arr = [] for i in range(int(n)): num = list(map(int, input().split())) arr.append(num) myarr = np.array(arr) print(np.transpose(myarr)) print(myarr.flatten())

  • + 0 comments
    import numpy as np
    
    N, M = map(int, input().split())
    elements=[]
    
    for _ in range(N):
        elements.append(list(map(int, input().split())))
    
    array = np.array(elements)
    print(array.transpose())
    print(array.flatten())
    
  • + 0 comments

    MY SOLUTION

    import numpy n,m = list(map(int,input().split())) l = [] for i in range(n): b= list(map(int,input().split())) l.append(b)

    a = numpy.array(l) print(numpy.transpose(a)) print(a.flatten())