import random
# Creating our tower
tower = []
stairNumber=31
roomNumber=10
cupBoardNumber=4
#Randoming a location for the RAT into the tower
ratStair=random.randint(0, stairNumber-1)
ratRoom=random.randint(0, roomNumber-1)
ratCupBoard=random.randint(0, cupBoardNumber-1)
#print(“The secret location of the RAT! stair “+str(ratStair)+” room “+str(ratRoom)+” cupboard “+str(ratCupBoard))
# Adding the stairs in the tower
print(tower)
# Adding the rooms in each stairs
for i in range(stairNumber):
#stair list insertion for each stairs
floor = []
tower.insert(i,floor)
#print(“stair “+str(i))
for y in range(roomNumber):
#room list insertion for each room
room = []
floor.insert(y,room)
for z in range (cupBoardNumber):
#cupboard list insertion for each cupboard
cupBoard = []
#empty value insertion for each cupboard
#print(z)
#RAT insertion
if (i==ratStair and y==ratRoom and z==ratCupBoard):
cupBoard.append(1)
else:
cupBoard.append(0)
room.insert(z,cupBoard)
print(tower)
#Locating the RAT
f=-1
for floor in tower:
f=f+1
r=-1
for room in floor:
r=r+1
c=-1
for cupBoard in room:
c=c+1
#print(cupBoard[0])
if (cupBoard[0]==1):
print(“the smelling rat is on floor:”+str(f)+” room “+str(r)+” cupboard “+str(c))