def create(self, cruise, room_type): #el día que esta función se ejecutó sin errores fue el día más feliz de mi trimestre no joke room_list = [] rooms_per_floor = Floor.create(Floor, cruise)[room_type - 1].quantity_of_rooms_per_hall * Floor.create(Floor, cruise)[room_type - 1].quantity_of_halls for n in range(rooms_per_floor): for rt, price in Cruise.api_saman_caribbean()[cruise].cost.items(): if room_type == 1: self.cost = Cruise.api_saman_caribbean()[cruise].cost['simple'] self.classification = 'simple' self.extra_info = 'Room service' elif room_type == 2: self.cost = Cruise.api_saman_caribbean()[cruise].cost['premium'] self.classification = 'premium' self.extra_info = 'Vista al mar' elif room_type == 3: self.cost = Cruise.api_saman_caribbean()[cruise].cost['vip'] self.classification = 'vip' self.extra_info = 'Se pueden realizar fiestas' self.capacity = self.room_capacity(cruise, room_type) self.reference = '-' self.hall_letter = self.assing_hall_letter(Floor.create(Floor, cruise)[room_type - 1].quantity_of_halls, Floor.create(Floor, cruise)[room_type - 1].quantity_of_rooms_per_hall)[n] self.number = n + 1 room = Room(self.cost, self.classification, self.capacity, self.hall_letter, self.number, self.reference, self.extra_info) room_list.append(room) return room_list
def show(cruise, room_type): #guardo en una variable la lista que devuelve la función create rl = Room.create(Room, cruise, room_type) l1 = [] for n in range(len(rl)): #en una lista vacía appendeo la información de las habitaciones que necesito l1.append(f'{rl[n].number}{rl[n].hall_letter}') #le paso la lista a la función que va a mostrar la matriz Floor.show(Floor.create(Floor, cruise), room_type, l1)