def find_lines_with_pies(file_path): result = "" try: with open(file_path, 'r', encoding='utf-8') as file: for line_num, line in enumerate(file, start=1): words = line.strip().split() for word in words: if word.lower() == "pies": result += line break except Exception as e: print(f"An error occurred: {e}") print(result) find_lines_with_pies("TaskA02/simple.in") find_lines_with_pies("TaskA02/polish_wiki_excerpt.in")