#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