Commit 5172de4d authored by deepak meena's avatar deepak meena

all files of taskB

parents
Group number 32
Group members:
(Silu Panda, 150050024),(Roshan lal meena, 150050038),(Deepak Meena, 150050039)
Honor code (Silu Panda ):- I pledge on my honour that I have not given or received
any unauthorized assistance on this assignment or any previous task.
Honor code (Roshan lal meena):- I pledge on my honour that I have not given or received
any unauthorized assistance on this assignment or any previous task.
Honor code (Deepak Meena):- I pledge on my honour that I have not given or received
any unauthorized assistance on this assignment or any previous task.
Individual Percentage :
Silu Panda:100%, Roshan lal meena:100%, Deepak Meena:100%
Extra Credit:
E.1) A tuple is a sequence of immutable Python objects. It can hold mutable objects such as lists. Assignments are not allowed in tuples.
E.2) Yes we can append elements to a list in a tuple. No this does not contradict the previous part. This is because tuples don't contain lists, strings or numbers. tuples contain references to other objects. The inablity to change the sequence of references a tuple contains doesn't mean that you can't mutate the object associated with those references.
def function1(string1, string2, listVariable):
newlist=listVariable+list(map(lambda x,y:(x,y), string1,string2))
return newlist
mylist=[1,2,3,4,5]
newList=function1("bombay","mumbaih",mylist)
print(mylist)
print(newList)
def function2(listVariable,n):
newList=list(map(lambda x:x[n-1], listVariable))
print(newList)
newList=sorted(listVariable, key=lambda x:x[n-1])
return newList
import sys
readfile=open('matrix.txt','r')
writefile=open('transpose.txt','w')
filedata=readfile.readlines()
m,n=map(int,filedata[0].split())
filedata.pop(0)
writefile.write(str(n) + " " + str(m) + "\n")
A,p,q = [[None for x in range(n)] for y in range(m)] , 0 , 0
AT = [[None for x in range(m)] for y in range(n)]
for line in filedata:
q= 0
for element in line.split():
A[p][q] = element
q= q + 1
p = p + 1
for p in range(n):
for q in range(m):
AT[p][q] = A[q][p]
writefile.write(str(AT[p][q]) + " ")
writefile.write("\n")
readfile.close()
writefile.close()
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