First, I have a file named "words.txt" with several words(apple noon tea water). and I want to make some code to check if there is a word that is a palindrome(noon).
my code is:
with open('words.txt','r') as file:
line = None
while line !='':
line = file.readline()
if line == line[::-1]:
print(line.strip('\n'))
else :
pass
but code doesn't work as my intent, It looks like If condition is being ignored
I don'n know why this happens. I need your help Thx