We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Transpose and Flatten
- Discussions
Transpose and Flatten
Transpose and Flatten
Sort by
recency
|
322 Discussions
|
Please Login in order to post a comment
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())
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())
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())