#這段代碼輸入以下值會報錯,輸入其他值都不報錯,一直查不出為什么,請大神們幫忙看下,謝謝。# 5# Prashant# 52.22# Kush# 52.223# Kant# 52.222# Kanti# 52.2222# Harshit# 52.22222M = []for _ in range(int(raw_input())): ? ?name = raw_input() ? ?score = float(raw_input()) ? ?L = [] ? ?L.append(name) ? ?L.append(score) ? ?M.append(L)if len(M) < 2: ? ?print '2 names must be given at least.'if len(M) > 5: ? ?print 'The number of names can not exceed 5'N = []for x in M: ? ?for y in M: ? ? ? ?if x[1] > y[1] and x not in N: ? ? ? ? ? ?N.append(x)for sec in N: ? ?for bigger in N: ? ? ? ?if sec[1] < bigger[1]: ? ? ? ? ? ?N.remove(bigger) ? ? ? ?if sec[1] > bigger[1]: ? ? ? ? ? ?N.remove(sec)N.sort()for result in N: ? ?print result[0]
嵌套列表迭代輸入特定值會報錯:ValueError: list.remove(x): x not in list
weibo_愚魯而迅達_03505084
2017-06-26 12:36:42