ValueError:max()arg是一个空序列[python 3]

ValueError:max()arg是一个空序列[python 3],python,python-3.x,runtime-error,Python,Python 3.x,Runtime Error,计算总和后列表是否为空 t = int(input()) while t > 0: n,m=map(int,input().split()) a=map(int,input().split()) l,o=sum(a),max(a) print(l) if ((o * n)-l) == m: print("YES") else: print((o * n)-l) print("NO") t

计算总和后列表是否为空

t = int(input())
while t > 0:
    n,m=map(int,input().split())
    a=map(int,input().split())
    l,o=sum(a),max(a)
    print(l)
    if ((o * n)-l) == m:
        print("YES")
    else:
        print((o * n)-l)
        print("NO")
    t = t-1
在Python3中,map()返回一个迭代器(与Python2不同)。
sum()
函数已经迭代了所有结果,现在迭代器为空:

>>> sample = '1 2 3'
>>> map(int, sample.split())
<map object at 0x10523b2e8>
>>> a = map(int, sample.split())
>>> list(a)
[1, 2, 3]
>>> list(a)
[]
在Python3中,map()返回一个迭代器(与Python2不同)。
sum()
函数已经迭代了所有结果,现在迭代器为空:

>>> sample = '1 2 3'
>>> map(int, sample.split())
<map object at 0x10523b2e8>
>>> a = map(int, sample.split())
>>> list(a)
[1, 2, 3]
>>> list(a)
[]
在Python3中,map()返回一个迭代器(与Python2不同)。
sum()
函数已经迭代了所有结果,现在迭代器为空:

>>> sample = '1 2 3'
>>> map(int, sample.split())
<map object at 0x10523b2e8>
>>> a = map(int, sample.split())
>>> list(a)
[1, 2, 3]
>>> list(a)
[]
在Python3中,map()返回一个迭代器(与Python2不同)。
sum()
函数已经迭代了所有结果,现在迭代器为空:

>>> sample = '1 2 3'
>>> map(int, sample.split())
<map object at 0x10523b2e8>
>>> a = map(int, sample.split())
>>> list(a)
[1, 2, 3]
>>> list(a)
[]
试着这样做:-

inputparam='100 2 300'
a = [int(i) for i in inputparam.split()]
maxNo=max(a)
sumno=sum(a)
试着这样做:-

inputparam='100 2 300'
a = [int(i) for i in inputparam.split()]
maxNo=max(a)
sumno=sum(a)
试着这样做:-

inputparam='100 2 300'
a = [int(i) for i in inputparam.split()]
maxNo=max(a)
sumno=sum(a)
试着这样做:-

inputparam='100 2 300'
a = [int(i) for i in inputparam.split()]
maxNo=max(a)
sumno=sum(a)