Commit be1fb313 authored by RISHABH GARG's avatar RISHABH GARG

Initial Commit

parents
5 5
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
\ No newline at end of file
def function1(string1, string2, listVariable):
String1 = list(string1)
String2 = list(string2)
res = zip(String1,String2)
listVariable.extend(res)
return listVariable
\ No newline at end of file
def function2(listVariable, n):
buff = map(lambda x: x[n], listVariable)
lis = list(buff)
return lis
\ No newline at end of file
# def function3():
data = open("matrix.txt")
size = data.readline().split()
matrix = [[None]*int(size[1])]*int(size[0])
# for i in range(0,int(size[0])):
# matrix[i] = []
# print(matrix)
for i in range(0,int(size[0])):
matrix[i] = data.readline().split()
# print(matrix)
transpose = list(map(list,zip(*matrix)))
f = open("transpose.txt","w")
f.write(size[1] + " " + size[0] + "\n")
for i in range(0,int(size[1])):
for j in range(0,int(size[0])):
f.write(transpose[i][j] + " ")
f.write("\n")
f.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