调试我的程序我得到max()arg是一个空序列

时间:2015-10-16 19:52:22

标签: python debugging count range max

我得到max()arg是一个空序列。我不太清楚如何处理它,我也想知道除了那个之外是否还有其他问题。

#getting file as input

print "Enter file name"

file1=raw_input()

#try block

try:

    error_to_catch=FileNotFoundError

#catching file not found exception

except NameError:

        error_to_catch=IOError

#opening file

fName = open(file1)

#initialising variables

sVal, totnumbers = 0, 0

#loop statement for n values

for line_number, line in enumerate(fName):

    numValues = map(int, line.split())

    #calculating sum

    sVal += sum(numValues)

    totnumbers += len(numValues)

#printing results

print "fileName",file1   

print "sum",sVal

print "count:", totnumbers

print "Average:", 1.0*s/totnumbers

#min max calculation

a=max(numValues)

b=min(numValues)

r=a-b

print "maximum",a

print "minimum",b

print "Range",r

value=raw_input('would you like to continue:')

if value=='Y':

    print "Enter file name"

    file1=raw_input()

else:

        print"good bye"

0 个答案:

没有答案