hi guys can anyone explain to me this code. i dont really get this. thanks a lot.

def readFile(name = ""):
try:
assert (name != "") , "The file name is not given!!"
except AssertionError:
print "file name is not given"
else:
try:
f = open(name, 'r')
except:
print 'File not found!'
else:
lines = f.readlines()
return lines
def fixNewline(lines):
newList = []
for line in lines:
line = line.replace("\n", "")
newList.append(line)
return newList

def converttoMatrix(lines):
matrix = []
for row in lines:
elements = row.split('\t')
rowToAppend = []
for element in elements:
rowToAppend.append(int(element))
matrix.append(rowToAppend)
return matrix

#to find the max value
def findmaxvalue(matrix):
maxvalue = 0
for row in matrix:
print row
for col in row:
print col
maxvalue = max(col,maxvalue)
return maxvalue

#to find the min value
def findminvalue(matrix):
minvalue = 0
for row in matrix:
#print row
for col in row:
#print col
minvalue = min(col,minvalue)
return minvalue


if __name__ == '__main__':
readFile()
readFile("")
readFile("xzy")


those inside the define statement are indented for some reason this would not allow me to indent. thanks for your help.

What are you trying to do? What do you need to find out? What does it do? Why should we help you? Why aren't you using code tags? What the hell are you even talking about...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.