def display_vote_lines():
with open("Elections.txt", "r") as f:
for line in f:
if "vote" in line:
print(line.strip())
This function accesses the file "Elections.txt" for reading. It employs with open() for secure file handling, ensuring automatic closure post-read. The function iterates through each line sequentially within a for loop. If a line contains the substring "vote", it is printed using print() after removing leading/trailing whitespace. Consequently, only lines containing the word "vote" are outputted.
