Commit 9e1e6a8e authored by PUJA RANI's avatar PUJA RANI

task3.py

parent fb3aa068
def printTrans(r,c,array):
f1 = open('transpose.txt','w')
f1.write(str(r))
f1.write(" ")
f1.write(str(c))
f1.write('\n')
transpose=list(zip(*array))
translist=list(map(list,transpose))
for x in range(0,c):
f1.write(' '.join(map(str,translist[x])))
f1.write('\n')
with open('matrix.txt') as f:
r, c = [int(x) for x in next(f).split()]
array = []
for line in f:
array.append([int(x) for x in line.split()])
printTrans(r,c,array)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment