# File path to read file_path = 'text.txt' # Open the file and search for lines containing the word "pies" with open(file_path, 'r') as file: lines_with_pies = [] for line in file: # Split the line into words and check for the word "pies" (case-insensitive) words = line.strip().lower().split() if 'pies' in words: lines_with_pies.append(line.strip()) # Display the results for line in lines_with_pies: print(line)