def get_numbers(): input_file = get_input_file() lines_input_file = utility.get_lines_of_file(input_file) numbers = "".join(lines_input_file) numbers = list(numbers.split(",")) numbers = list([int(number) for number in numbers]) input_file.close() return numbers
def get_clean_data(): with get_input_file() as input_file: lines_input_file = utility.get_lines_of_file(input_file) [list(line) for line in lines_input_file] lines_input_file = list(filter(lambda l: len(l) > 0, lines_input_file)) return lines_input_file
def get_clean_data(): with get_input_file() as input_file: lines_input_file = utility.get_lines_of_file(input_file) lines = list((line.split(",") for line in lines_input_file)) for i in range(len(lines)): lines[i] = (int(cord) for cord in lines[i]) return lines
def solve(): solution = 0 input_file = get_input_file() lines_input_file = utility.get_lines_of_file(input_file) solution = sum([int(line) for line in lines_input_file if line != ""]) input_file.close() return solution
def get_clean_data(): with get_input_file() as input_file: lines_input_file = utility.get_lines_of_file(input_file) maze_matrix = [] for y in range(len(lines_input_file)): row = [] for element in lines_input_file[y]: row.append(str_to_maze_object(element)) maze_matrix.append(row) maze = Maze(maze_matrix) player = maze.get_players_start_position() return maze, player
def get_clean_data(): with get_input_file() as input_file: lines_input_file = utility.get_lines_of_file(input_file) reactions = [] for line in lines_input_file: in_molecules, out_molecule = line.split(" => ") in_molecules = in_molecules.split(", ") molecule_sets = [] for molecule in in_molecules: amount, name = molecule.split(" ") amount = int(amount) molecule_sets.append(MoleculeSet(Molecule(name), amount)) out_mol_amount, out_mol_name = out_molecule.split(" ") out_mol_amount = int(out_mol_amount) out_molecule = MoleculeSet(Molecule(out_mol_name), out_mol_amount) reaction = Reaction(molecule_sets, out_molecule) reactions.append(reaction) return reactions
def get_clean_data(): with get_input_file() as input_file: lines_input_file = utility.get_lines_of_file(input_file) return lines_input_file
def get_clean_data(): with get_input_file() as input_file: lines_input_file = utility.get_lines_of_file(input_file) lines_input_file = list([line.split(",") for line in lines_input_file]) return lines_input_file