Commit 0f54af9d authored by UDDESHYA's avatar UDDESHYA

task3 done

parent 8226e88d
3 4
1 2 3 4
5 6 7 8
2 5 6 8
def function2(listVariable,n):
l = list(map(lambda elem : elem[n-1],listVariable))
l = list(map(lambda elem : elem[n],listVariable))
print (l)
l.sort()
return l
li = [(22,3),(2634,4642),(235,32)]
print (function2(li,2))
\ No newline at end of file
function2(li,1)
\ No newline at end of file
def function2(listVariable,n):
l = list(map(lambda elem : elem[n],listVariable))
return l
f = open('matrix.txt','r')
dim = next(f).split()
dim[0] = int(dim[0])
dim[1] = int(dim[1])
r = dim[0]
c = dim[1]
mat = [[None]*c]*r
for i in range(0,r):
ml =[]
for x in next(f).split():
ml.append(int(x))
mat[i] = ml
t = open('transpose.txt','w')
dim = [c,r]
k = ''.join(str(x)+' ' for x in dim)
t.write(k+'\n')
mat_tr = []
for j in range(0,c):
row = function2(mat,j)
mat_tr.append(row)
s = ''.join(str(y)+' ' for y in row)
t.write(s+'\n')
\ No newline at end of file
4 3
1 5 2
2 6 5
3 7 6
4 8 8
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