Commit 41769ec4 authored by HARSH  DEPAL's avatar HARSH DEPAL

added task1,task2,task3

parent df76fe4d
def function1( string1 , string2 , listVariable ) :
new_tuple = list(map(lambda x,y: (x,y),list(string1),list(string2)))
listVariable.extend(new_tuple)
return listVariable
list1 = [1,2,3,4,5]
print( list1 )
list2 = function1("Tarun","CSE",list1)
print( list2 )
def function2( listVariable,n ) :
print( list(map(lambda x: x[n],listVariable)))
return sorted( listVariable, key= lambda x: x[n] )
import sys
file = open('matrix.txt',"r")
output = open('transpose.txt',"w")
filedata = file.readlines()
row,col = map(int,filedata[0].split())
filedata.pop(0)
output.write(str(col) + " " + str(row) + "\n")
A,r,c = [[None for x in range(col)] for y in range(row)] , 0 , 0
AT = [[None for x in range(row)] for y in range(col)]
for line in filedata:
c = 0
for element in line.split():
A[r][c] = element
c = c + 1
r = r + 1
for r in range(col):
for c in range(row):
AT[r][c] = A[c][r]
output.write(str(AT[r][c]) + " ")
output.write("\n")
file.close();
output.close();
\ No newline at end of file
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