def row_minimum(x,L):
L=L
if x=='1':
row_minimum1=min(L[0],L[1],L[2],L[3],L[4])
return row_minimum1
elif x=='2':
row_minimum2=min(L[5],L[6],L[7],L[8],L[9])
return row_minimum2
elif x=='3':
row_minimum3=min(L[10],L[11],L[12],L[13],L[14])
return row_minimum3
table(L)
def user_input(y):
if y in ['1','2','3','A','B','C','D','E']:
condition = False
elif y !=['1','2','3','A','B','C','D','E']:
condition = True
while condition == True:
z=input("Enter a row (as a number) or a column (as and uppercase letter):")
if z in ['1','2','3','A','B','C','D','E']:
condition = False
return z
def menu(a,L):
if a==1:
display_table(L)
elif a==2:
x=input("Enter a row (as a number) or a column (as and uppercase letter):")
user_input(x)
print (user_input(x))
if user_input(x) in ['1','2','3']:
mini = row_minimum(x,l)
print ("2")
print("Minimum is:",row_minimum(x,L))
我得到USER_INPUT(X)爲無價值的價值,而不是我希望它從用戶拿這個值比較的if語句和做最小。錯誤而傳遞值在蟒蛇當用戶輸入
[同樣的問題](http://stackoverflow.com/questions/19698225/error-while-passing-the-value-in-python)呢? – devnull
您的'user_input()'函數僅在某些時候返回一個值。例如'user_input('1')'不會返回一個值。因此,如果'x = user_input('1')''x'的值是'None' –