def set_walls(rooms, walls):
    """
    Sets the number of walls between every room
    :param rooms: Dictionary of room objects
    :param walls: nested list containing number of walls between each room
    :return: the updated rooms dictionary
    """
    # loop through all walls except the first row, since does not contain any values, only room names
    for wall_set in walls[1:]:
        # for each wall in the set (exclude the first element, because that is the room name)
        for index, wall in enumerate(wall_set[1:]):
            # use the room name (first element of wall set) as a key to find the room to add walls to
            # then use other room associated with the number of walls (the first row of the walls parameter passed in)
            # as a key for the walls dictionary in each room object. Assign the value for that key to wall
            rooms[wall_set[0]].walls[walls[0][index + 1]] = wall

    return rooms