#room B register
#matrix method
roomB = [[],[]]
我打算在這裏只輸入3個單位roomB =如何設置python列表上的輸入限制3
def func():
row = int(input("Choose 0 or 1:"))
if (row == 0): # ROW 0 IS FOR HOUSE 1:
name = input("Enter your room name: ")
print("Enter M or N") #M for master room
room_type = input("") #N for normal room
for u in roomB: #3 units in roomB[0]
if(len(u)<3):
if (room_type == "M"):
return roomB[0].append([room_type,name,140])
if (room_type == "N"):
return roomB[0].append([room_type,name,140])
你的問題是什麼?你收到任何錯誤或意外的行爲? –
你期望輸出什麼? – Gahan
我沒有收到任何錯誤,但我希望我的輸出在我的列表中只插入3個單位你有任何建議我應該改變嗎? – Jordan